0

I want to know that how can I know that my website is embedded in iFrame and remove iFrame to load my site as usual with url in address bar!

just like this one:

<iframe src="http://varzesh3.com"></iframe>  
Nermia
  • 43
  • 1
  • 5
  • http://stackoverflow.com/questions/6158903/need-to-break-out-of-iframe-after-content-in-iframe-is-submitted – Pete Apr 03 '13 at 09:03
  • the solution is in this [question][1] itself [1]: http://stackoverflow.com/questions/4527464/preventing-iframe-embedding-but-with-one-exception – khaled_webdev Apr 03 '13 at 09:08
  • http://stackoverflow.com/questions/8524449/google-homepage-will-not-load-in-an-iframe – Roko C. Buljan Apr 03 '13 at 09:14

1 Answers1

1

You can achieve this quite easily by evaluating self and top, and then using replace() to break out of the frame:

if (self !== top)
    top.location.replace(self.location.href)
BenM
  • 52,573
  • 26
  • 113
  • 168