Assuming I have two html pages. Let’s assume foo.html
and bar.html
. foo.html
is linked twice to bar.html
. One from a picture and the other from text content. If a user now clicks on one of the two links on the first page (foo.html
) and thus gets to bar.html
, can you find out in bar.html which link the user followed?
Advertisement
Answer
You could add a query string to the links, e.g.
foo.html?picture
foo.html?text
then window.location.search will contain '?picture'
or '?text'