ruliang / reallysimplehistory

Automatically exported from code.google.com/p/reallysimplehistory
Other
0 stars 0 forks source link

rsh causing window to reload #82

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to integrate rsh into my app, but i am having problems in that
rsh will cause the browser window to reload use the following steps
1. open new window
2. click on link which calls dhtmlHistory.add ie: <a href'#'
onclick="(dhtmlHistory.add(\'customer/customerajax.php?cust_id=1','link');">test
</a>
3. Click on another link which may or may not call dhtmlHistory.add . The
link opens the request page into the <div> and then immediately reloads the
browser.

Also the fix for IE using iframes causes firefox to continually reload.

Remove the rsh code, all problems disappear.
Here is a snippet of the code I am using with prototype and 4 different div
containers. Thanks for your help.

<script type="text/javascript" src="js/rsh.js"></script>
<script type="text/javascript" language="JavaScript1.2"
src="stlib.js"></script>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/ajile/com.iskitz.ajile.js"></script>

<script type="text/javascript"><!--
function divlistajax (Mycontainer,Mybotcontainer,Mytopsearch,Mymenubut) {
  //container, botcontainer, topsearch, menubut
  if (Mycontainer != ''){new Ajax.Updater('container', Mycontainer, {
method: 'post' });}
  if (Mybotcontainer != ''){new Ajax.Updater('botcontainer',
Mybotcontainer, { method: 'post' });}
  if (Mytopsearch != ''){new Ajax.Updater('topsearch', Mytopsearch, {
method: 'post' });}
  if (Mymenubut != ''){new Ajax.Updater('menubut', Mymenubut, { method:
'post' });}
}
//--></script>

</head>
<body
onload="divlistajax('customer/customerlistajax.php','empty.php','topbuttons/cust
search.php','topbuttons/add_cust.php');">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                              <td><div id="menubut"><!-- menu buttons --></div></td>
                                              <td><div align="right"><div id="topsearch"><!-- Search
Screen --></div></div></td>
<td valign="top"><div id="popup"></div><div id="container"><!-- Main Screen -->
        </div><!-- eof Main Screen -->
        <div id="botcontainer"><!-- Bottom Screen -->
        </div><!-- eof Bottom Screen -->
        </td>                                           </tr>
</table>

<script type="text/javascript"><!--
window.dhtmlHistory.create({ //Use prototype JSON methods 
    toJSON: function(o) { return Object.toJSON(o); },
    fromJSON: function(s) { return s.evalJSON(); } 
  })

//Event Observations 
Event.observe(window, 'load', function() { //Initialize RSH 
    dhtmlHistory.initialize(); 
    dhtmlHistory.addListener(loadHistory); //On history change, call 'load'
function 
})

loadHistory = function(page) {
  if (page != ''){new Ajax.Updater('container', page, { method: 'post' });}
 dhtmlHistory.add(page); return false; 
 }
//--></script>
</body>
</html>

Original issue reported on code.google.com by lloydi...@gmail.com on 18 Mar 2009 at 12:47