views:

335

answers:

2

My code is in an iframe from a different domain, and I want to trigger a page refresh on the parent after changing the fragment of the URL (also of the parent). It happens on IE, but not on Firefox. Is there any way of doing it without changing the outer document (polling e.g.)?

<a href="http://top.domain.com/#fragment" target="_top">click me</a>

In IE this works fine, the outer frame reloads after clicking this link. Not so in Firefox.

I have already tried with a window.parent.location.reload(true), permission denied.

Thanks!

A: 

You can use meta refresh, or utilize another language like php which can do a header redirect.

Citizen
I want to refresh the parent, which I don't control
Victor
I have made the question clearer on that point, thanks.
Victor
Short of using AJAX on the parent, I don't think you can. If I were you, I would use ajax to send some vars out that the parent would pick up and then alter based on that.
Citizen
A: 

Well, this is what I finally did. Although it is not an optimal solution, at least it works: I force a reload of the parent by passing a dummy parameter with a timestamp on it, like this:

<a href="http://top.dom.com/?dummy=13758#frag" target="_top" id="link">click</a>

Generated with something like:

$("#link").attr("href", "http://top.dom.com/?d="+(new Date().getTime())+"#frag");

This is ugly as hell, but at least it works

Victor