Author: max
Date: 2007-11-13 17:29:07 -0800 (Tue, 13 Nov 2007)
New Revision: 7243
Modified:
openlaszlo/trunk/lps/includes/source/lzhistory.js
Log:
Change 20071113-maxcarlson-0 by [EMAIL PROTECTED] on 2007-11-13 15:37:06 PST
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Fix history in recent versions of Safari
New Features:
Bugs Fixed: LPP-4745 - History mechanism overwrites query parameters in Safari
Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: Add a link and click it if the version of safari is new enough.
Otherwise use the old form trick if the query string is not set.
Tests: Under Safari (3.0.4 (5523.10) under Leopard) and 2.0.4 (419.3) on
Tiger, history now works without overwriting the query string. Running
http://localhost:8080/trunk/my-apps/testiframe/test.lzx?lzr=swf8 allows the
history to be set without clearing out 'lzr=swf8'.
Modified: openlaszlo/trunk/lps/includes/source/lzhistory.js
===================================================================
--- openlaszlo/trunk/lps/includes/source/lzhistory.js 2007-11-14 01:07:43 UTC
(rev 7242)
+++ openlaszlo/trunk/lps/includes/source/lzhistory.js 2007-11-14 01:29:07 UTC
(rev 7243)
@@ -73,7 +73,7 @@
if (dojo.flash && dojo.flash.info && dojo.flash.info.installing)
return;
if (Lz.__BrowserDetect.isSafari) {
var h = this._history[this._historylength - 1];
- if (h == '') h = '#0';
+ if (h == '' || h == '#') h = '#0';
if (!this._skip && this._historylength != history.length) {
this._historylength = history.length;
if (typeof h != 'undefined') {
@@ -133,14 +133,24 @@
doc.location.hash = hash;
Lz.history._parse(s + '');
} else if (Lz.__BrowserDetect.isSafari) {
- // can't preserve query strings :(
- Lz.history._form.action = hash;
- top.document.location.lzaddr.history =
Lz.history._history.toString();
- Lz.history._skip = true;
Lz.history._history[history.length] = hash;
Lz.history._historylength = history.length + 1;
- Lz.history._form.submit()
- Lz.history._skip = false;
+ if (Lz.__BrowserDetect.version < 412) {
+ // can't preserve query strings :( do nothing if there is one.
+ if (top.location.search == '') {
+ Lz.history._form.action = hash;
+ top.document.location.lzaddr.history =
Lz.history._history.toString();
+ Lz.history._skip = true;
+ Lz.history._form.submit()
+ Lz.history._skip = false;
+ }
+ } else {
+ var evt = document.createEvent('MouseEvents');
+ evt.initEvent('click', true, true);
+ var anchor = document.createElement('a');
+ anchor.href = hash;
+ anchor.dispatchEvent(evt);
+ }
} else {
top.location.hash = hash;
Lz.history._parse(s + '');
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins