General TC > Programming & Scripting - Unofficial

FLOW: a deplorable web browser in only 19 KB

(1/4) > >>

MikeLockmoore:
When Chimera2 is just too big...  :P

Did you ever notice that the FLTK 1.1 library has a Fl_Help_View class that renders some ( ;)) HTML?  Wouldn't it be great to make a web browser with that?  And use wget to fetch the web pages and images?  And have a bit of other FLTK GUI to make it easy to navigate?  Well, I did, and I was able to create an FLTK executable that is less than 19 KB!  Here is a screen shot of my alpha version.

I'll post a .tce below if you'd like to try it.  It just has a few (   ::)  ) limitations, which I'll outline below.

FLOW: the Fast Light Openner of Webpages
--
Mike Lockmoore

MikeLockmoore:
OK, here's a few things you need to give up if you'd like to run FLOW:

0) Flash: no YouTube, Flash games, site intro animations, etc.
1) Client side scripting: no JAVA, javascript, etc., etc.
2) HTTPS encryption
3) Cascading Style Sheet (CSS) formatting
4) Frames
5) Forms and form submission
6) Most table formatting
7) Almost all character formatting
8) Basically, any attributes introduced about the time of HTML 2.0
... and probably dozens of other things.  But for everything else, you are golden!

Turns out, the Fl_Help_View window class has extremely limited HTML rendering capability.  Limited to:
1) Basic text
2) Header classes (<h1>, ... <h3>)
3) Unordered lists (but not ordered ones!)
4) Very basic tables
5) Inline images
6) Hyperlinks, including in-page links

That's basically it.  I thought it may be possible to implement forms using FLTK widgets floating on top of or next to the Fl_Help_View window, but it turns out the busybox version of wget is also very limited, and cannot use a POST type request needed for many form submissions.  

So, with these limitations, FLOW is basically useless for 95% (99%?) of web sites created after 1997 or so.  Actually, the tinycorelinux.com site is mostly navigable, and save for the missing header image (loaded through its CSS file), most pages are readible, but the screenshot area is not, nor is the forum.

So if you are brave enough to continue, you can try the .tce attached below.  You can pass a URL into the command-line:
# flow http://www.mywebsite.com/

Please always append a / at the end of your URL's unless you have a fully-qualified web page (e.g. # flow http://www.mywebsite.com/index.htm).  If you want to open a local file, the command-line is

# flow file:/path/to/my/file.ext

FLOW will fetch the raw web page using wget into /tmp/cache as the file step0.tmp.  Then it does some cleanup operations, resulting in step1.tmp.  Then it chops out all blocks of <script> ... </script> code, saving it as step2.tmp.  Then it pre-fetches any linked images, and rewrites those a fully-qualified URLs, resulting in the file FLOW_current.html.  This is the content of the FLOW browser window.  All image files will be also cached into /tmp/cache under its filename+ext.  It will track a few dozen sites in the history (so the Back and Next buttons work).  I don't have any mechanism for changing the home page, but you can start with any URL if you use the command-line to start it.

Given the limitations described above, I don't think I will be taking FLOW beyond this alpha release (at least not with these building blocks).  It was fun to create and experiment with, but my future effort will probably be better spent in other areas.  The Dillo web browser also uses FLTK, but it's using the pre-release FLTK version 2.0, which is not built into TC.  So maybe I could back-port Dillo (or at least a useful subset of it) to FLTK 1.1.  Or maybe I could extend Chimera2 to use FLTK to have a more modern GUI.  Or maybe I'll get around to making my own from-scratch browser just for fun (although I have a few other project ideas that might be more worthwhile).

Maybe for fun, you can post the many horrible ways you can make FLOW crash and burn!   ;)
--
Mike Lockmoore

[^thehatsrule^: please recall the guidelines; attachments removed]

jpeters:

--- Quote from: MikeLockmoore on July 19, 2009, 04:24:37 PM ---.  The Dillo web browser also uses FLTK, but it's using the pre-release FLTK version 2.0, which is not built into TC.  So maybe I could back-port Dillo (or at least a useful subset of it) to FLTK 1.1.

--- End quote ---

http://forum.tinycorelinux.net/index.php?topic=2070.0

^thehatsrule^:
There is the fltk `help` which may be of interest (included in TC).

Lee:
Hmmm...  Probably needs Flash 10.   ;D

Navigation

[0] Message Index

[#] Next page

Go to full version