Jump to content

difference between different page loading method.


toprashantjha

Recommended Posts

1. history will change the page to one of the URLs in, you guessed it, your history. You can't direct the user to just any url - it has to be one in their history.

 

2. reload, does just that - reloads the current page

 

3. replace will direct the browser to the selected URL, but I believe it also replaces the current page with the new page in the browsers history, which is the opposite of #4

 

4. Location directs the browser to a new URL and ADDs it to the history.

 

Example: user is on page one.htm and then clicks a link to go to page two.htm. Then on page two.htm javascriptuses replace to direct the user to  page three.htm. If the user clicks the back button they will go to page one.htm. If documnet.location was used, then the back button would take the user to two.htm

 

Again, not 100% sure on all of this (never had a need to use replace), but a quick search gave me that info. A quick test could verify.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.