I’d like to break out of the iframe of the fullscreen preview, how can I do that? It’s breaking something with facebook JS and renders some other scripts on the page useless not to mention the responsive features are not working that way. I tried http://themeforest.net/forums/thread/introducing-item-switcher/42612 but it doesn’t seem to work.
When I try to set/see parent.location.href I get Error: Permission denied to access property ‘href’ – maybe due to the cross domain.
I believe the classic approach is
top.location = self.location.href;, but I’m not quite sure about the security implications, or is this even possible..
Has anyone done this succesfully?
It doesn’t want to work for me:
Uncaught SecurityError: Blocked a frame with origin “xx” from accessing a frame with origin “http://codecanyon.net”. Protocols, domains, and ports must match.
Should I try with an empty page with just that code to see if something else on the site is breaking it or that’s not possible?
You can’t change the parent url that would be very unsafe.
Maybe you need to send a custom header or use postMessage. Hopefully a staff member can shed some light on this.
Aren’t custom headers only for the page that is contained within the iframe? I keep seeing postMessage as a possible solution, but doesn’t it need control over the page with the iframe, to work?
You should be able to use top object.
console.log( top.location );give you?
It shows up as DOMException in Chrome console.
It returns the proper location object in Firefox. But as soon as I start to access its properties like
I get errors.
I saw some themes months ago where that bar was removed, but I cant find any of them now.
If you anyone finds something maybe we can message the author or do some reverse engineering.
You cant change the parent location from within the iframe, its a basic crossdomain restriction.
A postMessage solution seems to be the right one, but it would need a parent frame response. So an API would exist.
I still see them all the time! Dtbaker does it very well, I already messaged him. Yes that’s my concern too that you need something from the Envato side to listen to the postMessage…