473,387 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Ajax page reload state

Hi this is a newbie alert! This may seem really basic to most, but I am a total beginner, so please don't laugh, or gif me false info...lol I will use it.

I have an ajax container loading on my site http://www.defyinggravity.co.za/home.html

In Firefox the navigation works perfectly, but in IE, NS and Opera when I scroll to the bottom of a page and then select a new page to navigate to, then the page new page loads from the previous pages state (at the bottom or middle, where ever I had scrolled to)

here is the code for the ajax, can anyone help please?

Expand|Select|Wrap|Line Numbers
  1. var loadedobjects=""
  2. var rootdomain="http://"+window.location.hostname
  3.  
  4. function ajaxpage(url, containerid){
  5. var page_request = false
  6. if (window.XMLHttpRequest) // if Mozilla, Safari etc
  7. page_request = new XMLHttpRequest()
  8. else if (window.ActiveXObject){ // if IE
  9. try {
  10. page_request = new ActiveXObject("Msxml2.XMLHTTP")
  11. catch (e){
  12. try{
  13. page_request = new ActiveXObject("Microsoft.XMLHTTP")
  14. }
  15. catch (e){}
  16. }
  17. }
  18. else
  19. return false
  20. page_request.onreadystatechange=function(){
  21. loadpage(page_request, containerid)
  22. }
  23. page_request.open('GET', url, true)
  24. page_request.send(null)
  25. }
  26.  
  27. function loadpage(page_request, containerid){
  28. if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
  29. document.getElementById(containerid).innerHTML=page_request.responseText
  30. }
  31.  
  32. function loadobjs(){
  33. if (!document.getElementById)
  34. return
  35. for (i=0; i<arguments.length; i++){
  36. var file=arguments[i]
  37. var fileref=""
  38. if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
  39. if (file.indexOf(".js")!=-1){ //If object is a js file
  40. fileref=document.createElement('script')
  41. fileref.setAttribute("type","text/javascript");
  42. fileref.setAttribute("src", file);
  43. }
  44. else if (file.indexOf(".css")!=-1){ //If object is a css file
  45. fileref=document.createElement("link")
  46. fileref.setAttribute("rel", "stylesheet");
  47. fileref.setAttribute("type", "text/css");
  48. fileref.setAttribute("href", file);
  49. }
  50. }
  51. if (fileref!=""){
  52. document.getElementsByTagName("head").item(0).appendChild(fileref)
  53. loadedobjects+=file+" " //Remember this object as being already added to page
  54. }
  55. }
  56. }
  57.  
  58. function MM_preloadImages() { //v3.0
  59.   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  60.     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  61.     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  62. }
  63.  
  64. function MM_findObj(n, d) { //v4.01
  65.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  66.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  67.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  68.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  69.   if(!x && d.getElementById) x=d.getElementById(n); return x;
  70. }
  71.  
  72. function MM_swapImgRestore() { //v3.0
  73.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  74. }
  75.  
  76. function MM_swapImage() { //v3.0
  77.   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  78.    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  79. }
Feb 7 '07 #1
2 2145
gyung
21
I helped someone with a similar problem before because I ran into a similar issue. I think you will find all the information you need here:

http://www.thescripts.com/forum/thread588665.html

Hope that helps.
Feb 7 '07 #2
Tx a stack will give it a bash

Have a great day!
Feb 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Yarco | last post by:
I want to use "Ajax" to create my web for hobby. But i don't know whether "Ajax" is mature... And what about with php? Someone have experience on it? ....
4
by: Trip | last post by:
Please if someone can help me !!! I need client and server code(principle based on AJAX) for next problem: i have 3 <select> tags on html page.(it must be NO page reload(callback) only...
6
by: Sabin.A.K, Bangalore | last post by:
Seen that AJAX makes the Python interfaces bit more User friendly. The Page refresh problems for the huge applications has slashed down extensively. Page reload has been faded out and eventually...
10
by: Steve | last post by:
I need to build a very dynamic client and would be interested in knowing the pros and cons of using JSF and Ajax to accomplish this. Thanks. Steve
0
by: arunprabu | last post by:
Hi, I have a problecm with the AJAX request in my webpage. I have some filters on top of the page. I have a submit button and an empty div below the filters. Some of the filters have ajax...
6
by: paladin.rithe | last post by:
I'm looking to use AJAX as part of the login system for a project, but I'm not finding what I'm looking for. I've seen the example of how to do an AJAX login, but that isn't really what I want....
1
by: empiresolutions | last post by:
Im using this script, http://www.captain.at/howto-ajax-form-post-get.php, to make an ajax request to php via a drop-down (DD) select. This works fine. Then using this script,...
10
by: =?Utf-8?B?RGFuaQ==?= | last post by:
Hi, Trying to create a master page that holds a menu, and the menu switches between pages in the site. 2 problem arrosed: a. When I navigate from page to page (all AJAX Web Forms, with the...
1
by: christian | last post by:
Hello I use a AJAX refresh script on a page to test a $var state <div> <? include ("include/refr.inc.php"); //ajax script for reload require ("bd_inc.php"); //test the line state buzy or...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.