Click to See Complete Forum and Search --> : parent.location.reload() not working in FireFox


AbrarNazeer
February 20th, 2008, 11:53 PM
Help me please....

myFile.js
window.onbeforeunload=init;
function init()
{ parent.location.reload(); }

Above code is working fine on F5 in IE to refresh the IFrame with it's Container Page but failed for FireFox

PeejAvery
February 21st, 2008, 08:22 AM
If this is a popup, use opener instead of parent.

EDIT:
refresh the IFrame with it's Container Page
Are you trying to refresh the parent of an iframe or refresh the iframe itself?

AbrarNazeer
February 26th, 2008, 01:41 AM
PeejAvery! Thanks for ur time ...

1) this is NOT a popup
2) I'm trying to refresh the parent of an iframe NOT iframe itself.

Background - Banner Images Pairs :
Actually , Iframe displays the Banner Image while Iframe Container Page display the Background Image. on F5 , this pair of images refresh perfectly in IE while in FireFox , Background Image become cached and IFrame refreshed , so the Pair of images become unmatched.

PeejAvery
February 26th, 2008, 09:04 AM
Are you sure it is a cache issue? If so, you can use <meta> tags to override the cache.


<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="Sat, 1 Jan 2000 00:00:00 GMT">

AbrarNazeer
February 26th, 2008, 11:32 PM
PeejAvery!
"<meta> tags" did not solve my problem. Means that "this is not a cache issue". But I'm stuck here to solve the issue on FireFox.

PeejAvery
February 27th, 2008, 07:06 AM
Well, the onbeforeunload event doesn't work in Firefox or Safari. At least not in my testing. The following worked perfectly fine though.

function init() {
parent.location.reload();
}
window.onunload = init;

AbrarNazeer
March 16th, 2008, 11:42 PM
PeejAvery!

function init() {
parent.location.reload();
}
window.onunload = init;

did not work fine on FireFox(2.0.0.12).

PeejAvery
March 17th, 2008, 08:51 AM
Well then there is something else you are doing that is blocking it. The attachment works perfectly.

AbrarNazeer
March 18th, 2008, 02:50 AM
PeejAvery! The code u ve sent is working fine (Thanks) . but fruitless for me.
Here is the short description of my requirement and issue...

JS file -----------------> Web Page #01
|
-----------------> Web Page #02

JS file displays the Banner and Background combination by the help of these 2 web pages. Code details are

1) Web Page #01 displays Banner in iframe,iframe attributes are set by JS File

var url = 'http://www.myWebSerer.com/WebPage01.aspx'

var oIfrm=document.createElement("IFRAME");
oIfrm.setAttribute('id','iframe1');
oIfrm.setAttribute('src',url);

2) Web Page #02 sets the background

document.body.background = 'http://www.myWebSerer.com/WebPage02.aspx';

the concerned thread's URL is
"http://forums.mozillazine.org/viewtopic.php?t=630475&highlight="
please visit for me.

PeejAvery
March 18th, 2008, 07:10 AM
I'm not going to join another forum for every person who comes on here and asks for help in multiple forums. That is a complete waste of my time.

If you are going to change the style of the background through CSS, you must use valid CSS.

document.body.background = 'url(http://www.myWebSerer.com/WebPage02.aspx)';