Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

document.referrer doesn't return page path

  • 5 trả lời
  • 2 gặp vấn đề này
  • 342 lượt xem
  • Trả lời mới nhất được viết bởi ArmandChoy

more options

I have a page that is loaded through apps.facebook.com

There are two paths that this page can be accessed from: apps.facebook.com/ProductionPage apps.facebook.com/DevelopmentPage (Not the actual urls, just used as an example)

I was using document.referrer to determine if the page was loaded through the Development path and if so load some debuging code. Now firefox was updated so document.referrer only returns the domain without the path. Is there any way or workarounds to get that path from the document.referrer?

Thanks, Armand Choy

I have a page that is loaded through apps.facebook.com There are two paths that this page can be accessed from: apps.facebook.com/ProductionPage apps.facebook.com/DevelopmentPage (Not the actual urls, just used as an example) I was using document.referrer to determine if the page was loaded through the Development path and if so load some debuging code. Now firefox was updated so document.referrer only returns the domain without the path. Is there any way or workarounds to get that path from the document.referrer? Thanks, Armand Choy

Giải pháp được chọn

The most obvious workaround seems to be to add a parameter to the URL you use to embed into the page, assuming FB allows that.

Đọc câu trả lời này trong ngữ cảnh 👍 1

Tất cả các câu trả lời (5)

more options

hi, maybe the following blog post can be of help?: https://blog.mozilla.org/security/2015/01/21/meta-referrer

more options

Wow, I didn't know about this change. FB is using:

<meta name="referrer" content="origin-when-crossorigin" id="meta_referrer" />

So yes, apps hosted on other hosts do not get the full URL under that policy:

http://www.w3.org/TR/referrer-policy/#referrer-policy-state-origin-when-cross-origin

more options

Giải pháp được chọn

The most obvious workaround seems to be to add a parameter to the URL you use to embed into the page, assuming FB allows that.

more options
more options

jscher2000 said

The most obvious workaround seems to be to add a parameter to the URL you use to embed into the page, assuming FB allows that.

While this doesn't solve the "problem" with document.referrer, I found out that facebook allows you to pass parameters to your page when you load apps.facebook.com.

Thanks for the replies!