javascript - If user came from previous page on site then this, else do this -


what viable way accomplish following:

a website has 2 pages; parent page , inside page. if user came inside page directly typing in address or following link page other parent page, show "foo". if user came inside page parent page, show "bar".

i need done in js if possible. if not, php secondary choice.

please try this

this code in second page

jquery(window).load(function() {   if (sessionstorage.getitem('dontload') == null) {     //show bar   }   else{     //show foo   } }); 

this code in parent page

jquery(window).load(function() {   sessionstorage.setitem('dontload','true')  }); 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -