Update of /cvsroot/magicajax/magicajax/Core/script
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13141/magicajax/Core/script
Modified Files:
AjaxCallObject.js
Log Message:
storing of PageStateCache is now done during 'window.onunload' instead of 'window.onbeforeunload'. So now ajax linkbuttons (href) won't call window.onbeforeunload anymore.
Index: AjaxCallObject.js
===================================================================
RCS file: /cvsroot/magicajax/magicajax/Core/script/AjaxCallObject.js,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** AjaxCallObject.js 21 Nov 2005 12:18:37 -0000 1.12
--- AjaxCallObject.js 21 Nov 2005 15:11:04 -0000 1.13
***************
*** 1,4 ****
--- 1,5 ----
__AJAXCboList = new Array();
__bPageIsStored = false;
+ __bUnloadStoredPage = false;
__PageStateCache = null;
__bTracing = false;
***************
*** 6,10 ****
__PreviousPostBack = null;
__PreviousOnPageLoad = null;
- __PreviousOnPageBeforeUnload = null;
__PreviousOnPageUnload = null;
--- 7,10 ----
***************
*** 73,76 ****
--- 73,77 ----
__bPageIsStored = bPageIsStored;
+ __bUnloadStoredPage = bUnloadStoredPage;
__PageStateCache = pageStateCache;
__bTracing = bTracing;
***************
*** 82,95 ****
__PreviousOnPageLoad = window.onload;
window.onload = this.OnPageLoad;
-
- __PreviousOnPageBeforeUnload = window.onbeforeunload;
- window.onbeforeunload = this.OnPageBeforeUnload;
}
! if ( bPageIsStored && bUnloadStoredPage )
! {
! __PreviousOnPageUnload = window.onunload;
! window.onunload = this.OnPageUnload;
! }
}
--- 83,90 ----
__PreviousOnPageLoad = window.onload;
window.onload = this.OnPageLoad;
}
! __PreviousOnPageUnload = window.onunload;
! window.onunload = this.OnPageUnload;
}
***************
*** 165,168 ****
--- 160,164 ----
if (html != "")
{
+ //alert('about to restore state');
document.forms[0].innerHTML = decodeURIComponent(html.substr(5));
__PageStateCache.value = "";
***************
*** 173,210 ****
}
- AjaxCallObject.prototype.OnPageBeforeUnload = function()
- {
- // Save the html of the form, so that it can be restored for the
- // browser's "Back Button"
- __PageStateCache.value = "HTML:" + encodeURIComponent(document.forms[0].innerHTML);
-
- if (__PreviousOnPageBeforeUnload != null)
- return __PreviousOnPageBeforeUnload();
- }
-
AjaxCallObject.prototype.OnPageUnload = function()
{
! if (document.forms[0]["__AJAX_PAGEKEY"] == null)
! return;
! var thePage = document.forms[0].action;
! var index = thePage.indexOf("?");
! if (index != -1)
! thePage = thePage.substring(0, index);
! thePage = thePage + "?__AJAX_PAGEUNLOAD=" + encodeURIComponent(document.forms[0]["__AJAX_PAGEKEY"].value);
! var oThis = AJAXCbo;
! __AJAXCboList.push(oThis);
! AJAXCbo = new AjaxCallObject();
! if( oThis.XmlHttp )
! {
! oThis.XmlHttp.open('GET', thePage, true);
! oThis.XmlHttp.onreadystatechange = function(){ };
! oThis.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
! oThis.XmlHttp.send(null);
}
!
if (__PreviousOnPageUnload != null)
return __PreviousOnPageUnload();
--- 169,206 ----
}
AjaxCallObject.prototype.OnPageUnload = function()
{
! if ( !__bPageIsStored || !__bUnloadStoredPage )
! {
! // Save the html of the form, so that it can be restored for the
! // browser's "Back Button"
! __PageStateCache.value = "HTML:" + encodeURIComponent(document.forms[0].innerHTML);
! //alert('just saved state');
! }
! else
! {
! if (document.forms[0]["__AJAX_PAGEKEY"] == null)
! return;
! var thePage = document.forms[0].action;
! var index = thePage.indexOf("?");
! if (index != -1)
! thePage = thePage.substring(0, index);
! thePage = thePage + "?__AJAX_PAGEUNLOAD=" + encodeURIComponent(document.forms[0]["__AJAX_PAGEKEY"].value);
! var oThis = AJAXCbo;
! __AJAXCboList.push(oThis);
! AJAXCbo = new AjaxCallObject();
! if( oThis.XmlHttp )
! {
! oThis.XmlHttp.open('GET', thePage, true);
! oThis.XmlHttp.onreadystatechange = function(){ };
! oThis.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
! oThis.XmlHttp.send(null);
! }
}
!
if (__PreviousOnPageUnload != null)
return __PreviousOnPageUnload();
|