Jump to content

What is the difference between LocationObj.replace() and LocationObj.assign() ?


brucemand

Recommended Posts

Location Object MethodsMethod Descriptionassign() Loads a new documentreplace() Replaces the current document with a new one
is there a particular time when one wouuld use window.location.replace() instead of window.location.assign()i haven't checked if it makes a difference to the HistoryObj.
Link to comment
Share on other sites

is there a particular time when one wouuld use window.location.replace() instead of window.location.assign()i haven't checked if it makes a difference to the HistoryObj.
a quick google search gets the job done everytimehttps://developer.mozilla.org/en/window.location#Methods
replace(url) Replace the current document with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session history, meaning the user won't be able to use the Back button to navigate to it.
Link to comment
Share on other sites

a quick google search gets the job done everytime
heh-heh, yeah - just saw many "students" asking lazy questions and thought, yeah - i'll have me some of that as well ! :)for your efforts, i bring you a gift (incase you don't know of it yet) - will serve you with more dramatic effect for your next handling of a lazy student ! :)http://tinyurl.com/6koytbmEDIT: ooh, looky - this thread is 2nd on the list !! :P
will not be saved in session history
i suppose i was expecting that answer.
Link to comment
Share on other sites

heh-heh, yeah - just saw many "students" asking lazy questions and thought, yeah - i'll have me some of that as well ! :)for your efforts, i bring you a gift (incase you don't know of it yet) - will serve you with more dramatic effect for your next handling of a lazy student ! :)http://tinyurl.com/6koytbmEDIT: ooh, looky - this thread is 2nd on the list !! :P i suppose i was expecting that answer.
IMO, a more practical search (like the one I did) would have been just the window.location object. and yes, I am aware of LMGTFY.
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...