iframe - JavaScript error top is undefined -


i have few pages load in iframe. load outside of

but top undefined when opened outside it. know can check if top defined use self if not defined. there better way?

it seems window.top always defined (at least in ff , chrome) , refer window if page loaded top document, should not issue.
otoh, window.top not part of standard, browsers might implement differently (yes, i'm looking @ you, ie). more info: mdn - window.top.

in case have test, can make compact:

(window.top || window.self).location.href = ...; 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -