in javascript its known to me how to find the page's URL so I can potentially use it for a range of purposes
if (top!= self) top.location.href = self.location.href; // step out of a frame
so is PHP able to find self.location.href or should I stick to JavaScript?
href
Moderator: General Moderators
href
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP
Re: href
In PHP you have to use combination of $_SERVER variables.
You can get current URL by using following code
You can get current URL by using following code
Code: Select all
$href = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
- TildeHash
- Forum Commoner
- Posts: 43
- Joined: Fri Jul 16, 2010 7:17 am
- Location: Apple Valley, California
Re: href
If it's a PHP file that is responsible for the JavaScript output and you're using the JavaScript on the page via the <script> tag, than the following code will give you the full page URL:Vegan wrote:in javascript its known to me how to find the page's URL so I can potentially use it for a range of purposes
if (top!= self) top.location.href = self.location.href; // step out of a frame
so is PHP able to find self.location.href or should I stick to JavaScript?
Code: Select all
<?php
echo $_SERVER["HTTP_REFERER"];
?>Re: href
This should help:
http://knowpapa.com/url/
http://knowpapa.com/url/