In fact, you could lose the JavaScript altogether and just make a simple A HREF link right to the current page. You would then change out the JavaScript formats above to simply go to the URL rather than looking at the history file. you use that full URL in each of the elements above, you’ll lessen the chance the page will cache. For example, the full URL of this page is: A Webmaster friend told me that if you simply set up a link to the current page but use the entire URL, the page would always reload from the server because the request starts at the domain. Here’s the same effect in a button:Īgain, it’s possible that a page using the methods shown above can get cached and can stop reloading from the server. The zero is the current page since in JavaScript, lists (arrays) are numbered starting with zero. Try it:Ĭlick to refresh the pageHere’s the code:Ĭlick to refresh the pageRather than using a refresh command, I like to go to the history of the page and set it to zero. It is true that pages can become cached if they are reloaded a great many times, but I have had pretty good success with this. I’ve seen this done a number of ways, but this is my favorite because it, again, forces the browser to load from the server. I don’t have a refresh on this page because the darn thing would just keep refreshing and there’s nothing on this page that will update. I found the sites displaying stock information were set to around five minutes or 300 seconds. I checked a couple of online sites and they were all set about the same. Right now, the command is set to reload every 15 seconds. Once in there, change the number of seconds you wish the page to wait before starting the reloading process. Copy and paste it into the document you wish to reload. One will reload every so many second all on its own and the other will reload when the user asks for it. You want your site to do the trick either by itself, or by offering a method whereas the user simply clicks and the browser does it for them.īelow I have two methods. That’s a proven method but it’s not exactly very pretty to have text asking the user to hold and click. Most people know it can be done by hand by holding the shift key and clicking the “Refresh” (on IE) or “Reload” (on Navigator) buttons. The trick to reloading the page is to force the browser to not look into the cache, but rather to again make a connection to the Web and bring up the document from the server. While going through my notebook of possible topics, this one came up as one that is asked about a fair amount so I thought I’d write up a quick tutorial. The answer is pretty easy so I usually just wrote and answered in the email. People wrote asking how the stock sites got their pages to reload all by themselves. Var ScrollSneak = function(prefix, wait) else if (document.documentElement & ( || started to get email asking for this effect right around the time Internet stocks took off. when a page loads, the window.name object is checked to see if a scroll position has been stored in it, and if it has one, it scrolls to that position.when one of those links is clicked, the click handler grabs the scroll position from the window or document object and stores it as a string on the window.name object and then allows the new page to load.click handlers are applied to the links that should maintain the scroll bar position between page loads.It mentions click handlers applied to the links. There is a JS file in the header and javascript at the end of the page. Hi I have had a good search around and came across this script but dont have a clue how to call it in my page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |