Saturday, October 20, 2007

Using 4D Live Window

Bill Hutton gives talk on 4D Live WindowThese are notes from the "4D Live Window" session presented by Bill Hutten of Pelican Engineering at 4D Summit 2007.

The Live Window plugin is part of 4D Web 2.0. It's included with the 4D Ajax Framework, but it's completely separate.

It's based on Safari on Mac and IE on Windows - whatever version you have installed. Live Windows doesn't do anything itself - just wraps the system supplied browser.

It works with both local HTML files and HTML via HTTP. Windows requires http:// to get documents via HTTP, the Mac is OK without the HTTP. There are also differences in retrieving local files - the Mac likes file://, Windows wants something like c:\. If you have the PDF browser plugin installed on the Mac it won't display PDFs, but it will without the plugin (using OS X's built in PDF support). Word and Excel files are suported (with editing abilities) on Windows (if Office is installed), but not on Mac. There are a bunch of other platform specific differences...

You can also put the contents of HTML formatted text in a BLOB into the Live Window area. Problem is, under Windows put it at the lowest security setting which means it won't run Javascript or get CSS files. Also, it's slow. It's faster to write it to disk and give Live Window a local URL.

About:blank will crash Live Window on Windows.

You can also "get content" of the area into a BLOB which is an easy way to scrape HTML documents if you don't already have a way to do that.

You can also get the content as a picture. It's the entire page - not just what you can see - it will be a very tall picture in many cases.

Web Back, Web Forward, Web Refresh, and Web Stop are also useful features.

Live Window + Mac + Javascript heavy sites + resizing the window = CRASH

If the page opens a new window via Javascript, it will work on Windows, but not on Mac. On Mac it will display in the main window. You can control how it works on Windows.

In other words, it's an imperfect browser...

You can also turn on/off contextual menus.

You can change the user agent on the Mac (on Windows it's always IE). If you don't do this some web sites will think you're using a non-standard browswer and won't work.

You get an event before and after the user (or Javascript) clicks on a link as well as progress events that get called many times as the page loads. It doesn't give you control - just detection. The issue is that the navigation events can be Javascript calls which you want to handle differently than user clicks and you can't tell the difference. And realize the "history" could be back, forward, back, forward - so it's only so useful. Realize the the progress may go down as you load the page - it's a quirk of the engines - not 4D's fault.

No control keystroke works in form areas (tab, delete, copy, etc.), however there are contextual menus for these items - not ideal (at all)...

Javascript execution does not work on the Mac - at all... It only works on Windows. But the cool thing is that you can execute your own Javascript command on thet page with Web_JavaScriptExecute(). With this you can insert Javascript on the page and then call it... If you insert the same Javascript function more than once it will overwrite the initial method. You can also get return values from the Javascript functions.

Browser plugins (like Flash) do work.

You can not access the local 4D web server in single user.


Bill Hutton contacted me with the following clarifications...
About:blank will actually crash LW on Mac - on Windows it's not required, but on Mac the docs indicate it should be called before using Web_SetContent (which as you point out should probably be avoided anyway)

Re: event handling - if you pass negative values when using Web_SetPreference with the Web_kNavigate selector then you do get control over how LW responds to navigate events (clicks, etc). Your callback will be executed, and you can choose to ignore the click, or to use Web_SetURL to follow it (or another URL).

Labels: ,

Digg It!  Add to  Add to StumbleUpon  Add to Reddit  Add to Technorati  Add to Furl  Add to Netscape


thinkx said...

> Javascript execution does not work on the Mac - at all

Oh wow.. that comes as a shock. Any indication is this will be fixed. Specifically, I was hoping 4D Live Window would quickly migrate to the Safari 3.0 engine.

Saturday, October 20, 2007 8:40:00 PM EDT  
Jay Harper said...

As mentioned, Live Window uses whatever version of Safari or IE that you have installed. So if you upgrade to Safari 3, Live Window will use Safari 3.

As far as Javascript execution not working on the Mac, I think he meant the ability to embed and execute your own code. I think Javascript that's already on the page will work fine. At least that was how I understood it.

Saturday, October 20, 2007 9:11:00 PM EDT  
bhutten said...

Re Javascript execution: Perhaps this was not made clear in the presentation (alas). Websites that contain Javascript generally work OK on both platforms (there are exceptions). But the Javascript commands /in the plugin/ - ie Web_JavascriptExecute and Web_JavascriptReturn do not work on the Mac.

(All the issues around Javascript and LiveWindow are confusing - it's not hard at all to find JS-heavy sites that work fine in Safari, for example, but do not work in LiveWindow. I've not been able to determine exactly what the causes are...)

Sunday, October 21, 2007 10:12:00 AM EDT  
Larry said...

I think the easiest way to highlight the issues with Live Window and Javascript on the Mac as well as the input issues on Windows (tab etc) are with an example.

One of the most compelling potential uses of Live Window is dynamic input forms. The combination of the Javascript issues (from the plugin commands) on Mac and the lack of tab key etc on Windows is that it renders this potential use of LW not viable.

As an examle of a javascript heavy site that does not work is the Robohelp HTML help system. As a first pass at LW usage we were intending to use LW to show the help in a local window. Unfortunately on Mac the Robohelp HTML help does not work correctly with the embedded Javascript when redered in LW. It works correctly in Safari.

One thing that does work well is dynamic custom reporting in LW using HMTL reports. You can create very compelling reports in LW.

Sunday, October 21, 2007 6:50:00 PM EDT  

Post a Comment

Links to this post:

Create a Link

<< Home