Solved

Set referer to something else when page loads

Posted on 2006-11-24
4
338 Views
Last Modified: 2012-06-27
Hi,

Lets say I have a page that loads and says "You came from XYZ". XYZ being the referer we just came from.

I want to blank out the referer variable when my page loads. When my page loads it should say "You came from <blank>"

What i'm trying to achieve is to stop all javascripts running on my page from getting my page referer.

Thanks
0
Comment
Question by:zattz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 9

Expert Comment

by:lucki_luke
ID: 18010748
Hey,

in PHP you can modify the referer in the $_SERVER variable (if at all, read below):
$_SERVER['HTTP_REFERER']

Statement from the PHP documentation:
The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

But I'm not sure about the javascript thing, because the javascript will run on the clients machine, thus in the browser and therefore it might be that the referer is not editable for the javascript part because the php stuff runs all on the server. This depends on how the javascript uses the referer.

Lukas
0
 
LVL 11

Accepted Solution

by:
ch2 earned 500 total points
ID: 18011212
You can't do that with Javascript or PHP.

Those headers are set by the client (browser) and recived by the server (webserver).
0
 
LVL 16

Expert Comment

by:HackneyCab
ID: 18011711
If you control those Javascript applications, why not just edit them to remove any reference to the referrer?
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question