Jump to content

Different Page URL based if loaded in Iframe rather than regular document


andyjimmy

Recommended Posts

Hi All,

The title of my question does seems rather ambiguous, but please allow me to explain. What i'm looking to impliment is this, I want http://mydomain.com/artist/artist_name.html to load in two different ways depending on how they are loaded.

For example if you put http://mydomain.com/artist/artist_name.html into your browser address thingo it loads up the page complete with page headers, the information about the artist and the page footer, just like a normal website.

--BUT--

If its loaded in an iframe it only displays the artist info.

I hope that makes sense. So what i'm after is something in the artist_name.html that recognises the iframe that it has been loaded in. Does anyone know if this is even possible, can anyone point me/ provide me with some code etc that would give the desired result.

Kind Regards and thanks in advance!!


Well this could be done with php rather easily. I am not so sure about javascript.

Here is an example.

[code=php:0]
$referer = $_SERVER['HTTP_REFERER'];
if ($referer !== 'http://www.yoursite.com/yourframedpage.html') {
  header('Location: http://www.yoursite.com/yourframedpage.html');
}
[/code]

Good Luck,
Tom

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.