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!!


Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.