最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to get referrer URL after a redirect in javascript - Stack Overflow

programmeradmin4浏览0评论

If you enter an invalid video id in YouTube (e.g. ) 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 "") in javascript?

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

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)

Share Improve this question asked Nov 1, 2009 at 3:36 user200368user200368
Add a comment  | 

2 Answers 2

Reset to default 11

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)

  1. 暂无评论