Solved

Set referer to something else when page loads

Posted on 2006-11-24
4
333 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Php Array Diff 3 27
php documentation 4 21
XML Data Missing in PHP SimpleXML 8 22
Return data with AJAX, JQUERY and PHP 13 32
Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now