Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
Different header referer than document.referrer

this is my request header:

GET / HTTP/1.1
Host: localhost:3002
Connection: keep-alive
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
sec-ch-ua-platform: "Linux"
Accept: */*
Origin: http://127.0.0.1:5500
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://127.0.0.1:5500/new.html
Accept-Encoding: gzip, deflate, br
Accept-Language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7
If-None-Match: W/"c-Lve95gjOVATpfV8EL5X4nxwjKHE"
Request URL: http://localhost:3002/
Request Method: GET
Status Code: 200 OK
Remote Address: [::1]:3002
Referrer Policy: unsafe-url

and my console returns for document.referrer and location.href:

document.referrer
'http://127.0.0.1:5500/test.html'
location.href
'http://127.0.0.1:5500/new.html'

test.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="unsafe-url"/>
    <title>Document</title>
</head>
<body>
    <a href="/new.html" target="_blank"  referrerpolicy="unsafe-url">test</a>

</html>

new.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="unsafe-url"/>
    <title>Document</title>
</head>
<body>
    <script>
        setTimeout(() =>{
            console.log(fetch("http://localhost:3002/"))
        }, 4000)
    
    </script>
</body>
</html>

as you can see the header referer is different then document.referrer, it is even possible to get referer from previous page and set it into referer header?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

as you can see the header referer is different then document.referrer

Because you are asking for the referrer in different documents which the browser was referred to by different documents.

The browser is asking for / because new.html told it to ask for it. The referer is new.html.

it is even possible to get referer from previous page and set it into referer header?

No. You cannot make the browser lie about what referred it.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!