21

I know on the same page frame or parent I can make either go to something via window.location however is there a means of checking to see if I am in the iframe and if so make the top (parent window) location go somewhere?

asked Jun 7, 2012 at 23:48

1 Answer 1

62

This is a simple code to check if your page is loaded in iframe:

if (window.location != window.parent.location)
 window.parent.location = "http://someurl";
answered Jun 7, 2012 at 23:54
Sign up to request clarification or add additional context in comments.

2 Comments

tell me why is it always the simple things that evade me the most.. ay ya.. thank you.. :-)
Well, you can thank me by upvoting and accepting my answer :)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.