开发者

Header location in javascript

开发者 https://www.devze.com 2023-01-05 14:57 出处:网络
is it possible to in javascript like in php header location, if the visitor 开发者_StackOverflow中文版comes from index html alert something? and how ? thank youif(document.referrer == url){ alert(msg)

is it possible to in javascript like in php header location, if the visitor 开发者_StackOverflow中文版comes from index html alert something? and how ? thank you


if(document.referrer == url){ alert(msg); }

Should do it.


Check the referrer, but you most likely will need the absolute uri, like this:

if (document.referrer == 'http://domain.com/index.html')
    alert('How was the index?');
0

精彩评论

暂无评论...
验证码 换一张
取 消