Tuesday, November 27, 2007

Embedded Web Page

I finally had time to play with Nathan Freeman's embedded frameset technique that he posted on his blog awhile back. He has on his web site his Sesame Street demo that he created. It is a really cool idea that he came up with. So I thought I could expand on this technique and demonstrate how you could use this technique to embed a web page within a Lotus Notes document.

I thought a good demo would be embedding Google Map onto a Lotus Notes document. This would be great to have in something like a contact management system. Rather than having it pop up in a new Lotus Notes window, you could have the Google Map appear inside the document. Using the technique that Alan Lepofsky mentioned on his blog, google mapping technique, you can combine the two techniques to create an embed Google Map.



Since Google Map does not look too good in a small embedded window, I created it as a pop up window within the document using layers.

I have included the code for this in the sample database. link Here is how it works.

In the form “URLaddress,” I created a series of fields that represents the contact information for a person. There is also a hotspot that will be used to display Google Map for that contact.

Just as with the Sesame Street demo we created a frameset that has a hidden frame named “launcher.” We create a form named “secondform” that autoframes in the hidden frame, “launcher.” In the form “URLaddress” we create a layer that has an embedded editor that displays the form “secondform.” This will force the frameset to appear within the embedded editor in the form. The layer serves as a pop up window and its appearance is determined by the value in the field “closeField”.



When you click on the hotspot on the form “URLaddress” it will calculate the Google URL for the contact location. This information is then stored in a notes.ini parameter “URLFIELD.” The field “closeField” which determine if the pop up layer is shown is set to “1” and the document is refreshed. When the document is refreshed, the embedded frameset appears.

The main frame of the frameset displays an URL that is either a blank Lotus Notes page, “blankpage” or the Google Map URL that was stored in the notes.ini parameter “URLFIELD”.



Unfortunately, one issue that has come up is that if the Web page has an input field in it, the focus will remain there until you close off the Web page. The backspace and cursor keys will not work otherwise. Therefore, in the X close button in the pop up layer, the code clears the notes.ini parameter when you close the pop up layer so that when you refresh the page the web page is closed.

There is a number of different things that you could do with this technique including creating composite applications. So try it and thank Nathan Freeman for his embedded frameset technique. Next time, composite applications even on Notes 5 clients.

1 comment:

quintessens said...

I looked at this approach to include a 'preview' browser to show how documents look in a browser. Unfortunately the support for CSS for the browser in Notes is so poor, even in Notes 8 that I find not done to use this functionality...