History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-5530
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: P0 P0
Assignee: Max Carlson
Reporter: Lorien Henry-Wilkins
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

The history mechanism is incompatible with the html tag

Created: 28/Feb/08 03:26 PM   Updated: 02/Mar/08 03:02 PM
Component/s: Browser Integration
Affects Version/s: Freya, RingDing (4.1)
Fix Version/s: RingDing (4.1), Mars

Time Tracking:
Not Specified

Severity: Minor
Fixed in Change#: 8,145
Runtime: N/A
Fix in hand: False


 Description  « Hide
The history mechanism doesn't work with the html tag. Hitting the back button just navigates the iframe back, so the history mechanism doesn't even kick in until you have cycled through all of the iframe history. In firefox the contents of the iframe are not updated when you hit back, so it looks like nothing is happening until you hit back enough times to cycle through all iframe history.
 
A solution to this problem is to use window.location.replace instead of setting the source of the iframe. This replaces the URL in the history rather than adding to the history queue. This does require that you get the frame by name from the frames collection rather than getting the iframe element by id. I tested this locally and it work as expected. Let me know if you need more details.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Amy Muntz - 29/Feb/08 04:55 PM
Changed "Fix Version" to Mars.

Max Carlson - 29/Feb/08 06:36 PM
Author: max
Date: 2008-02-29 18:32:24 -0800 (Fri, 29 Feb 2008)
New Revision: 8145

Modified:
   openlaszlo/trunk/lps/components/extensions/html.lzx
   openlaszlo/trunk/lps/components/extensions/test/html.lzx
   openlaszlo/trunk/lps/includes/source/iframemanager.js
Log:
Change 20080229-maxcarlson-c by maxcarlson@Roboto on 2008-02-29 12:04:27 PST
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Add API to enable/disable history for the html tag

New Features:

Bugs Fixed: LPP-5530 - The history mechanism is incompatible with the html tag

Technical Reviewer: promanik
QA Reviewer: lhenrywilkins@laszlosystems.com
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: extensions/test/html.lzx - Add history attribute example.

extensions/html.lzx - Add history attribute to html tag. If true, iframe chagnes will be added to the browser history. If false, iframe reloads are not added.

iframemanager.js - Set frame name based on id if not specified. Store frame names for lookup for in setSrc().
    
Tests: Change the history attribute in extensions/test/html.lzx to false and notice that reloading addresses doesn't add browser history entries.



Modified: openlaszlo/trunk/lps/components/extensions/html.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/html.lzx 2008-03-01 02:28:06 UTC (rev 8144)
+++ openlaszlo/trunk/lps/components/extensions/html.lzx 2008-03-01 02:32:24 UTC (rev 8145)
@@ -1,5 +1,5 @@
 <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2007-2008 Laszlo Systems, Inc. All Rights Reserved. *
 * Use is subject to license terms. *
 * X_LZ_COPYRIGHT_END ****************************************************** -->
 
@@ -22,8 +22,8 @@
     ,setPosition: function(id, x, y, width, height, v) {
         LzBrowser.callJS('Lz.iframemanager.setPosition', false, id, x, y, width, height, v);
     }
- ,setSrc: function(id, src) {
- LzBrowser.callJS('Lz.iframemanager.setSrc', null, id, src);
+ ,setSrc: function(id, src, history) {
+ LzBrowser.callJS('Lz.iframemanager.setSrc', null, id, src, history);
     }
     ,setVisible: function(id, v) {
         LzBrowser.callJS('Lz.iframemanager.setVisible', false, id, v);
@@ -49,8 +49,8 @@
     <attribute name="heightoffset" type="number" value="0"/>
     <attribute name="loading" type="boolean" value="false"/>
     <attribute name="appendto" value="null"/>
- <attribute name="iframe" value="null"/>
     <attribute name="ready" value="false"/>
+ <attribute name="history" value="true"/>
 
     <attribute name="target" value="null" setter="this.setTarget(target)"/>
     <attribute name="framename" value="" type="string"/>
@@ -86,7 +86,7 @@
         this.src = s;
         this.setAttribute('loading', true);
         if (this['iframeid']) {
- Lz.iframemanager.setSrc(this.iframeid, s);
+ Lz.iframemanager.setSrc(this.iframeid, s, this.history);
         } else {
             this.srcset = s;
         }
@@ -120,7 +120,7 @@
         this.iframeid = id;
         this.__updatepos();
         if (this['isfront']) this.bringToFront();
- if (this['srcset']) Lz.iframemanager.setSrc(id, this.srcset);
+ if (this['srcset']) Lz.iframemanager.setSrc(id, this.srcset, this.history);
         this.setAttribute('ready', true);
     </method>
     <method name="__gotload">

Modified: openlaszlo/trunk/lps/components/extensions/test/html.lzx
===================================================================
--- openlaszlo/trunk/lps/components/extensions/test/html.lzx 2008-03-01 02:28:06 UTC (rev 8144)
+++ openlaszlo/trunk/lps/components/extensions/test/html.lzx 2008-03-01 02:32:24 UTC (rev 8145)
@@ -21,7 +21,7 @@
             </handler>
         </button>
         <text name="status" y="3" fontstyle="bold" visible="${parent.main.loading}">Loading...</text>
- <html name="main" heightoffset="-74" widthoffset="-19" xoffset="7" yoffset="50">
+ <html name="main" heightoffset="-74" widthoffset="-19" xoffset="7" yoffset="50" history="true">
             <handler name="oninit">
                 this.bringToFront();
             </handler>

Modified: openlaszlo/trunk/lps/includes/source/iframemanager.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/iframemanager.js 2008-03-01 02:28:06 UTC (rev 8144)
+++ openlaszlo/trunk/lps/includes/source/iframemanager.js 2008-03-01 02:32:24 UTC (rev 8145)
@@ -5,6 +5,7 @@
 Lz.iframemanager = {
     __highestz: 0
     ,__frames: {}
+ ,__namebyid: {}
     ,create: function(owner, name, appendto) {
         //alert(owner + ', ' + name + ', ' + appendto)
         var i = document.createElement('iframe');
@@ -14,8 +15,9 @@
         var id = '__lz' + Lz.iframemanager.__highestz++;
         Lz.iframemanager.__frames[id] = i;
 
- if (name == null) name = '';
+ if (name == null || name == 'null') name = id;
         if (name != "") Lz.__setAttr(i, 'name', name);
+ this.__namebyid[id] = name;
 
         if (appendto == null || appendto == "undefined") {
             appendto = document.body;
@@ -50,12 +52,20 @@
     ,getFrame: function(id) {
         return Lz.iframemanager.__frames[id];
     }
- ,setSrc: function(id, s) {
+ ,setSrc: function(id, s, history) {
         //console.log('setSrc', id, s)
- var iframe = Lz.iframemanager.getFrame(id);
- if (! iframe) return;
- Lz.__setAttr(iframe, 'src', s);
- return true;
+ if (history) {
+ var iframe = Lz.iframemanager.getFrame(id);
+ if (! iframe) return;
+ Lz.__setAttr(iframe, 'src', s);
+ return true;
+ } else {
+ var id = Lz.iframemanager.__namebyid[id];
+ var iframe = window[id];
+ if (! iframe) return;
+ iframe.location.replace(s);
+ return true;
+ }
     }
     ,setPosition: function(id, x, y, width, height, visible) {
         //Debug.write('setPosition', id);


_______________________________________________
Laszlo-checkins mailing list
Laszlo-checkins@openlaszlo.org
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins