开发者

How to get referrer URL after a redirect in javascript

开发者 https://www.devze.com 2022-12-10 03:11 出处:网络
If you enter an invalid video id in YouTube (e.g. http://www.youtube.com/watch?v=XXX) it will redirect you to a page saying it is a开发者_运维百科 malformed video ID. Is there a way to get the origina

If you enter an invalid video id in YouTube (e.g. http://www.youtube.com/watch?v=XXX) it will redirect you to a page saying it is a开发者_运维百科 malformed video ID. Is there a way to get the original URL (in this example "http://www.youtube.com/watch?v=XXX") in javascript?

(I'm talking about Javascript that will run on the browser after the redirect, through Firebug)


You are looking for document.referrer.


Use a <meta> tag in your codebase with these two attributes name and content, i.e.:

<meta name="referrer" content="always" />

This is how you can set the referrer value after a redirect.

0

精彩评论

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

关注公众号