Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide referrer on iframe

Is it possible to remove referrer when using iframe? here the case:

I have a page at http://www.mywebsite.com with an <iframe> in it. Like this:

<html>
 <head>...</head>
 <body>
  ...
<a href="#loadiframe">SHow Website</a>
  <iframe id="#loadiframe" src="http://www.iframetarget.tld">
  ...
 </body>
</html>

i want to iframetarget.tld not contains referrer/can not see if mywebsite.com is loading their pages.

is that possible?

Note: iframe will load using jQuery lightbox/colorbox

like image 733
Andy Avatar asked Apr 06 '13 02:04

Andy


People also ask

Does iframe send referrer?

Referrer. When loading an iframe, the browser sends it important information about who is loading it in the Referer header (notice the single r , a typo we must live with). The referrerpolicy attribute lets us set the referrer to send to the iframe when loading it.

What is referrer policy attribute?

The HTML <a> referrerpolicy attribute is used to specify the reference information that will be sent to the server when the user clicks on a hyperlink. Syntax: <a referrerpolicy="no-referrer|no-referrer-when-downgrade|origin| origin-when-cross-origin|same-origin| strict-origin-when-cross-origin|unsafe-url">

What is referrer policy strict origin cross origin?

strict-origin-when-cross-origin offers more privacy. With this policy, only the origin is sent in the Referer header of cross-origin requests. This prevents leaks of private data that may be accessible from other parts of the full URL such as the path and query string.


2 Answers

None of these answers worked for me, but MDN's iframe reference states that setting the referrerpolicy to no-referrer will accomplish this and it worked for me. Support in older browsers will be hit or miss.

Example:

<iframe src="https://whatsmyreferer.com/" referrerpolicy="no-referrer" style="width: 100%; height: 300px;"></iframe>
like image 64
Twyx Avatar answered Oct 16 '22 11:10

Twyx


<iframe id="#loadiframe" src='javascript:window.location.replace("http://www.iframetarget.tld")'>

It works.

like image 28
Ngô Văn Thao Avatar answered Oct 16 '22 11:10

Ngô Văn Thao