Home Link to previous page if exists and is not an external link
Reply: 0

Link to previous page if exists and is not an external link

user944
1#
user944 Published in April 19, 2018, 10:04 am

This question already has an answer here:

  • How do you access browser history? 4 answers
  • In what cases will HTTP_REFERER be empty 4 answers

I want to create a go back button on a single.php in WordPress. I know I can easily do that with window.history.go(-1) but in the case of the visitor come from another site, I want to redirect to the homepage of my site.

In other words: How can I know if the previous page is an internal link to my site? And if not, redirect to the homepage?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.586638 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO