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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.