Javascript to detect where newly opened window came from

Posted by teggy on Stack Overflow See other posts from Stack Overflow or by teggy
Published on 2010-05-12T17:23:08Z Indexed on 2010/05/12 17:34 UTC
Read the original article Hit count: 148

Filed under:

Let's say I have a page, http://mydomain.com/mypage.html, with a "Back to page" link. This link should take the user back to the page where they came from only if the previous page URL matches one of the following: http://mydomain.com/one.html, http://mydomain.com/two.html, and http://mydomain.com/three.html. Otherwise, it would take the user back to the homepage, http://mydomain.com. I would like the "Back to page" link to also take the user back to the homepage when http://mydomain.com/mypage.html is pasted onto the browser. How can i accomplish this with Javascript. Thanks!

© Stack Overflow or respective owner

Related posts about JavaScript