admin管理员组

文章数量:1316030

I am using React and I am getting the document referrer using

document.referrer

However when I am directed to my url from google, I am just getting the domain in document.referrer instead of something like this: ;rlz=1C1CHBF_enIN850IN850&oq=fb&aqs=chrome.0.69i59j46i199i291i433j0i131i433l2j0i395j69i60l3.1007j1j9&sourceid=chrome&ie=UTF-8.

Is there someway I can get the entire URL including pathname and query string? Thanks in advance.

I am using React and I am getting the document referrer using

document.referrer

However when I am directed to my url from google., I am just getting the domain in document.referrer instead of something like this: https://www.google./search?q=fb&rlz=1C1CHBF_enIN850IN850&oq=fb&aqs=chrome.0.69i59j46i199i291i433j0i131i433l2j0i395j69i60l3.1007j1j9&sourceid=chrome&ie=UTF-8.

Is there someway I can get the entire URL including pathname and query string? Thanks in advance.

Share Improve this question edited Dec 17, 2020 at 8:55 Álvaro González 147k45 gold badges278 silver badges376 bronze badges asked Dec 17, 2020 at 8:43 BhushanBhushan 5056 silver badges11 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

Websites can set a Referrer-Policy. If they don't then, as of version 85, Chrome defaults to strict-origin-when-cross-origin. (Other browsers will have their own defaults, but Chrome's marketshare makes it worth highlighting)

This means that the referrer information will include only the origin and not the full URL.

This is a feature designed to protect the user's privacy.

There is no way around it unless you control the site that controls the link (in your example: www.google.).

本文标签: javascriptHow to get exactly url from documentreferrerStack Overflow