?
Solved

Set referer to something else when page loads

Posted on 2006-11-24
4
Medium Priority
?
339 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 1500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

762 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