(note this is a guest post by Tenox)
UPDATE: there is a new version released as a Web Proxy service and available for both Mac OS X and Linux. Read on here…
Quite a while ago I’ve came across Opera rendering proxy for mobile browsers. This got me thinking. If you could render a web page on a proxy server to a simplified HTML, say 3.x. This would make a lot of web browsers happy. For some unrelated purposes I have been using webkit2png which allows to create a whole web page snapshot in a single png image. Wait… what if such image had an image map of clickable regions pointing to the original links? Maybe…
The idea was born, but was it possible to implement and would it work? Webkit2png was quite far from having all the required functionality. For various reasons Python and I will never be friends, so extending the original script was bit out of luck. Fortunately though after some additional research I have stumbled upon picidae network. To my utter surprise they actually made all or even more functionality that I wanted in their picidae.py script. All that had to be done to adapt picidae to my purpose was to save the image as a GIF image, generate a simple HTML page with an input box and strip all the unwanted stuff. This I could survive in Python.
Webrender.py came to life. It’s a cgi-bin application that resides on a machine in the middle. It renders a gif image and spits out to the browser together with a simple web page, containing a URL and search input boxes plus the gif and image map.
After some initial debugging and massaging out few bugs the solution worked perfectly! I could finally get the old browsers happily navigate modern websites! Check out some examples:
Yes! You can finally browse microsoft.com with IE 1.5 !
Or go to netscape.com in Netscape 4.x browser. This was impossible just a short while ago!
You can now read news using old Mosaic!
How about some non-windows browsers:
Nothing is perfect though and there are some major caveats using this solution:
- The script currently only runs on Mac OS X. Although theoretically possible to use on Linux, I haven’t been able to do so far. Maybe the readers can help!
- I have been doing most of development work on Snow Leopard under VMware. I know that Mavericks sometimes suffers from the error described here. Hopefully it can be resolved soon.
- An application using the display engine has to run under a regular user and it just cannot be run from Apache / daemon user. Therefore the install is rather clumsy. However a built-in python web server comes handy for it.
- Can’t handle downloads etc. I’m planning to implement bypass mode for that.
I’m currently rewriting the script to work as a fully fledged HTTP proxy server instead of a cgi-bin application. It’s actually 99% complete minus some python multithreading issues.
I’m also thinking about rewriting it in something more portable. For instance QtWebKit, WebKitGTK+, PhantomJS, or maybe a totally different layout engine all together.
The cgi-bin version is available for download here. To install create a cgi-bin subdirectory, place the script in there, chmod 755, start python web server: python -m CGIHTTPServer 8000 then point your browser to http://x.x.x.x:8000/cgi-bin/webrender.py