0

Is there a way from the server side to determine if the page being loaded is within an iframe, our a stand alone page? Is there a head or something that tells you it's within an iframe without the client telling you.

Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
  • Possible duplicate of [How to identify if a webpage is being loaded inside an iframe or directly into the browser window?](https://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t) – Matt Jul 28 '17 at 03:43
  • Why not just check for the presence of a second `` tag? – Obsidian Age Jul 28 '17 at 03:46
  • @MikeFlynn What do you mean from the server side? You send the HTML to the client. The server doesn't know or care where the data is going. Can you post a [mcve] so we can duplicate your issue? – Matt Jul 28 '17 at 03:51
  • What **exactly** are you trying to accomplish? Why are you trying to target an iframe's content from the server? Why do you not want to do this client-side? Why can you not simply run a conditional that checks that the output location is an ` – Obsidian Age Jul 28 '17 at 03:51
  • Wow. You ask a question that multiple people think is vague, then tell people trying to extract more information out of you **in order to help you** to simply not bother. Please refer to the help article regarding [**how to ask good questions**](http://stackoverflow.com/help/how-to-ask), then people won't **have** to ask for clarification. – Obsidian Age Jul 28 '17 at 03:55
  • **All commenters:** please review the ["Be Nice"](http://stackoverflow.com/help/be-nice) policy. Comments are not for extended discussion, nor are they for lecturing each other. – elixenide Jul 28 '17 at 04:18
  • Thank you for being thorough on my question duskwuff. These other guys are posting links to policies because they can't understand a question. – Mike Flynn Jul 28 '17 at 20:41

1 Answers1

0

Not really.

If your page is being loaded in an iframe, the URL of the parent frame will be in the Referer header (unless referrer policies prevent it from being sent). However, the same thing will happen if your page is being loaded as the result of the user clicking a link on the source page -- there's no way to tell the two apart from the server side.