my problem is with using
$_SERVER
in IE.it doen't work. what can i do instead ?

Recommended Answers

All 4 Replies

Are you using a secured page (Https)? If so, then apparently is isn't passed.

i think because i used onclick event to open the link,so it returns Null in IE.
i'm not sure.i have to test it.

Member Avatar for diafol

Yep this is because of the js. It fails with both window.location and window.location.ref. Normal links are supported. Haven't seen a workaround for this.

$_SERVER should be fully supported, but I've found it reasonably unreliable.

Hey.

In general, you should never rely on any sort of client-controlled functionality for your sites to work. Like the HTTP_REFERE or cache-control headers.

Use server-side methods, like sessions or databases, to do stuff like this if the functionality of your site depends on it.
Try just always writing the current URL into a session variable at the bottom of the page, and use that instead of the HTTP_REFERER. It's not perfect, but it's more reliable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.