简体   繁体   中英

js for redirecting page on condition

I think having searched, sorry if my question has already been answered.

My website static HP (/index.html) is divided into sections:

info, #bib, #cat ...

and sofar, not to display an empty page, it redirects to the #info section like this:

<body onload="window.location.href = 'index.html#info';">

I'd very much need the redirection to happen only when visitors come from another site.

I mean, i can set links in other pages pointing to the #cat or #bib sections, but like this only the #info section shall display.

Is that possible? How can i get it? Thanks in advance A.

$_SERVER['HTTP_REFERER'] in php might help you. Do you want to redirect to a particular link when it comes from some other website or link?
If so, above mentioned solution will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM