In my site I have a password protected page containing some links to other sites also operated by myself that cannot be password protected. I would like to place a HTML code
Try this
function url(url){ return url.match(/:\/\/(.[^/]+)/)[1]; } function check() { var ref = document.referrer; if(url(ref) =='www.google.com') { // do something } else { // redirect window.location.href = 'http://yourDomain.com'; } }