If come to page from link in footer do this

Is it possible to do some jquery IF i came to current page from a link in the footer.

like:

if(come from footer link) {
  $(element).show();
}

You can use document.referrer which returns the URI of the page that linked to the current page.

Be warned, however: the value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).

Yes it is - the footer links can have a querystring as a part of their link, for example:

<a href="anotherpage.html?source=footer">Another page link</a>

At anotherpage.html you can easily check for that source value in the querystring, using a simple jQuery query-object plugin.

if ($.query.get('source') === 'footer') {
    // they came from a link in the footer
}

Although this is a more robust solution, this results in ugly urls.
If this is something you care about, I guess you could also use local storage.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.