Recent

Author Topic: Let's write a web browser  (Read 20114 times)

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Let's write a web browser
« on: May 18, 2018, 06:36:41 am »

JD

  • Hero Member
  • *****
  • Posts: 1908
Re: Let's write a web browser
« Reply #1 on: May 18, 2018, 07:31:37 am »
how-to instructions

Bravo! Very nice. Where can i get that TWebBrowser component? The one shipped with Lazarus 1.8.2 does not seem to have the additional TWebInspector, TWebAddressBar and TWebCollapsePanel that yours has.

Thanks,

JD
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Let's write a web browser
« Reply #2 on: May 18, 2018, 08:57:52 am »
is your component open source?
Lazarus 2.0.2 64b on Debian LXDE 10

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1216
    • Burdjia
Re: Let's write a web browser
« Reply #3 on: May 18, 2018, 11:07:24 am »
This makes me feel nostalgia.  I wrote my "own" bewbrowser using Delphi 6 back in the days.  It was MDI and had a nice bookmarks manager (actually I did it because I hated the bookmarks used by all browsers and I still hate them).  I've lost the sources.  :'(  May be I rewrite it. ::)
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: Let's write a web browser
« Reply #4 on: May 18, 2018, 11:58:02 am »
This is an open source set of controls I am working on which will be released soon on gtihub. The browser is based on the wekbit engine, and it's accompanied by a collection of native controls and other code to make working with related materials easy/easier.

A related portion I am working on in parallel is an interface to the webkit javascript core engine. Although it is in a separate package, the jsc tools I am working on provide the ability to intermix pascal code and javascript in your applications. But also, you can use the jsc tools to take to talk your application from inside a webpage, and your application can call javascript to interact with a webpage.

Or, you can not use a web browser at all, and just work with javascript inside your pascal apps.

Stay tuned. If you want to help me test or give me feedback on some demo ideas or the programming interface (code design) before I publish, let me know. Probably

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: Let's write a web browser
« Reply #5 on: May 18, 2018, 08:11:51 pm »

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: Let's write a web browser
« Reply #6 on: May 18, 2018, 08:26:54 pm »
Here is as a side note ... I've taken an innovative approach to making the JSC package friendly, even for non Pascal users. A feature I haven't mentioned yet is a help system I've baked into using custom modules. When you write a module for JavaScript, my system allows you to associate a help resource with your custom objects and their methods. This allows users to learn how to use your module by simply using your objects without invocation.

Example:

system.console.log(system.console); // writes out all the help for how to use the console object
system.console.log(system.console.inspect); // writes out all the help for how to use the console.inspect method
let help = system.file.openReader.toString(); // variable s now hold the help for how to use the FileReader object

I have written a lot of the help resources already, but more work is needed to bring the help for all module to a professional level of documentation and organization. I will also need help in providing translations for this help system. The help resources are text files located in the resources/help folder of the JSC package source and a script to rebuild the help will be included with the JSC package.

guest58172

  • Guest
Re: Let's write a web browser
« Reply #7 on: May 18, 2018, 09:46:28 pm »
how-to instructions

Nice. I see possible application for a documentation viewer, e.g see local html but without a whole web browser interface.
Will there be deps or everything will be statically linkable  (*.a / *.lib for webkit) ?

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: Let's write a web browser
« Reply #8 on: May 18, 2018, 10:21:48 pm »
Will there be deps or everything will be statically linkable  (*.a / *.lib for webkit) ?
Currently I don't think it's feasible to use static linked a/lib files. The webkit engine itself takes many hours to build even on a high end pc. Also, the libraries in so/dll form are typically already present on systems, and can be updated to fix security issues such as exploits. As such it makes sense to link to so/dll functions using the Pascal external directive.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Let's write a web browser
« Reply #9 on: May 18, 2018, 10:35:14 pm »
Also, the libraries in so/dll form are typically already present on systems

On Mac and iOS, yes, as part of the Apple WebKit framework, but I wouldn't expect to find WebKit on Windows systems, don't know about Linux so much (gtk3 and the like is probably a rounding error in usage in the desktop world).

In the TWebBrowser control, I focused on LCL widgetsets with support: Cocoa and Qt4. LCL Qt5 widgetset does not include support for WebView so it would probably need support outside of LCL for TWebBrowser.

https://macpgmr.github.io

Windows would certainly be the missing piece in TWebBrowser, but WebKit won't be installed by default on Windows, so something like the Shell.Explorer ActiveX control would probably need to be used. I don't know about the newer Edge browser things.



sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: Let's write a web browser
« Reply #10 on: May 18, 2018, 11:00:05 pm »
Phil, thanks for the information. About Gtk3 version of WebView, I have it done and it works fantastic, as long as you don't try to build the Lazarus IDE in Gtk3, but tell Lazarus to target Gtk3 instead. I've fixed a few problems with the LCL Gtk3 widgetset as well that may help bring a full Gtk3 Lazarus dream closer to reality.

See https://webkitgtk.org

Regarding Webkit on Windows, yes it'll have to be an external runtime distributed along side any executable that wants to use a WebView. This shouldn't be too much of a issue, given how much functionality it's providing.

https://webkit.org/webkit-on-windows/

Also note that all Webkit libraries also include JavaScript Core as a not only as part of the browser, but also as a stand alone JavaScript engine. The packages I am writing mirror this design, allowing programmers to either run a JSC context, or get a JSC context from a WebView after it establishes an appropriate state (e.g. starting to load content).

If you'd like to coordinate with me on the WebView for the  Qt/Mac side, let me know because I'd appreciate the help. I think you'll find the manner in which I've abstracted the platform specific interface interesting, along with the JSC way interop is being handled.
« Last Edit: May 18, 2018, 11:05:59 pm by sysrpl »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Let's write a web browser
« Reply #11 on: May 18, 2018, 11:16:43 pm »
Regarding Webkit on Windows, yes it'll have to be an external runtime distributed along side any executable that wants to use a WebView.

Back in the old days when I still did desktop software development, I would use the 10:10:10 rule, which says that there are 10 Windows desktops for every Mac desktop and 10 Mac desktops for every Linux desktop. In other words, if you had 1,000 Windows users, then a Mac version probably made sense, maybe even a Linux version. But if you only had 100 Windows users, then a Mac version may not make sense and Linux definitely not. Etc.

I don't think those ratios have changed much.

https://netmarketshare.com/operating-system-market-share.aspx?options=%7B%22filter%22%3A%7B%22%24and%22%3A%5B%7B%22deviceType%22%3A%7B%22%24in%22%3A%5B%22Desktop%2Flaptop%22%5D%7D%7D%5D%7D%2C%22dateLabel%22%3A%22Custom%22%2C%22attributes%22%3A%22share%22%2C%22group%22%3A%22platform%22%2C%22sort%22%3A%7B%22share%22%3A-1%7D%2C%22id%22%3A%22platformsDesktop%22%2C%22dateInterval%22%3A%22Monthly%22%2C%22dateStart%22%3A%222018-04%22%2C%22dateEnd%22%3A%222018-04%22%2C%22segments%22%3A%22-1000%22%7D

I guess that's just a way of saying that Windows is important and might be a good place to look at next.

If you'd like to coordinate with me on the WebView for the  Qt/Mac side, let me know because I'd appreciate the help. I think you'll find the manner in which I've abstracted the platform specific interface interesting, along with the JSC way interop is being handled.

Gee, I don't know. We're way past peak desktop. Even Web sites need to be mobile optimized, since that's how users are likely to first come to them. I just did TWebBrowser because I thought it looked like something fun to do (and it was), but I don't know if anyone has ever used it - part of the problem is just how few actual developers there are here and when you do the intersection of any two developers' interests it's often the null set. (Like mapping, in the world I work in, everyone and every company is doing mapping. But here? Nobody.)

But if I come back to TWebBrowser I'll take a look at what you're doing. Maybe this summer some time.



lainz

  • Hero Member
  • *****
  • Posts: 4738
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Let's write a web browser
« Reply #12 on: May 18, 2018, 11:43:04 pm »
I think it has no sense of making a web browser.

I think now with the evolving state of pas2js, and the ability of making node.js applications, you can use Electron and forget about making a web browser, instead make modules for Electron, that's tested and works fine.

Then you can develop your JS apps made with Lazarus and FPC, distribute with Electron.

If you need to distribute a web browser, do like that. If not, better, and let your application run on a real browser.

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: Let's write a web browser
« Reply #13 on: May 18, 2018, 11:50:28 pm »
Phil,

I'm sure a lot of people still use Desktop/Laptop computers, and the vast majority of those people are running Windows, but for me personally, the last version of Windows I cared to use regularly was Windows 7. I refuse to use Windows 10, and also refuse to use iOS/Android as my means to do "computing".

This is more of a personal project, but also one that bridges the platform gap by making Web development a bit different. That is, allowing for different integration between Desktop and Web applications than previously available.

Some of the demos I am working on include recording actions in a paint type applications as JavaScript text, allowing the user to replay paint actions using a combination of visual actions and script functions.

Another demo I am working on involves designing a basic Web page that runs SQL queries by communicating directly with a database module (hosted by a Lazarus application), and formatting SQL results through JSON data as rich pageable data tables.

I've started work on an application that takes a WebView out of a window, and places it on your desktop with a non rectangular shape. That is, the content render in a WebView determines the shape of the application. It has access through JavaScript to Pascal modules and can do things like show a pretty rendering of your network traffic, or cpu temp, or fan speed.

And finally, I want to create a JavaScript plug in for Lazarus that allows you modify the IDE and designers using JavaScript. For example, a script could be written to rename several components at once, or resize a form designer based on what controls it currently contains.

Anyhow, these are all things done out of my interest, and although you might not interested, I appreciate your opinions. Thanks.

RAW

  • Hero Member
  • *****
  • Posts: 871
Re: Let's write a web browser
« Reply #14 on: May 19, 2018, 12:15:31 am »
Quote
... you can use Electron and forget about making a web browser, instead make modules for Electron, that's tested and works fine.
I really don't know ELECTRON, but people say there are some serious security issues. Is that the case or is it as always a lot of marketing stuff or exaggerations?
Has anybody experiences with it?

 

TinyPortal © 2005-2018