Reputation: 2877
On a certain page, I want to execute jQuery code when: (1) the user arrives to that page from a different page, and (2) through a URL that has an anchor tag in it (site.com/page#anchor_tag). Is that possible in jQuery?
Upvotes: 0
Views: 34
Reputation: 780724
For (1) check document.referer
to see if you came from a different page.
For (2) you can use window.location.hash
to get the part of the URL beginning with #
.
Upvotes: 2