How to reload a whole frameset with Opera

S

Stefan Mueller

After my web page has been loaded I'm doing some tests with a JavaScript. If
I figure out that something is wrong I'd like to reload the whole frameset.

With Internet Explorer and Mozilla Firefox I can reload the whole frameset
with
parent.location.href = "index.html";

However, this doesn't work with Opera.
Does someone know how to do that with Opera?

Stefan
 
S

Stefan Mueller

Try top.location.href or just window.location.reload();.

Unfortunately it doesn't work.
top.location.href = "index.html"; works exactly same like
parent.location.href = "index.html";
That means, in Internet Explorer and Mozilla Firefox the frameset gets
reloaded and in Opera it doesn't work.
window.location.reload(true); reloads the current frame and not the whole
frameset.

Perhaps I have the ask my question a little bit more precise.
index.html has the frameset with two frames (frame1.html and frame2.html).
Within frame1 I'd like to reload the whole frameset (index.html) with a
JavaScript. With parent.location.href = "index.html"; or top.location.href
= "index.html"; it works fine with Internet Explorer and Mozilla Firefox but
not with Opera.

Stefan
 
S

Stefan Mueller

Try top.location.href or just window.location.reload();.

Unfortunately it doesn't work.
top.location.href = "index.html"; works exactly same like
parent.location.href = "index.html";
That means, in Internet Explorer and Mozilla Firefox the frameset gets
reloaded and in Opera it doesn't work.
window.location.reload(true); reloads the current frame and not the whole
frameset.

Perhaps I have to ask my question a little bit more precise.
index.html has the frameset with two frames (frame1.html and frame2.html).
Within frame1 I'd like to reload the whole frameset (index.html) with a
JavaScript.
With parent.location.href = "index.html"; or top.location.href =
"index.html"; it works fine with Internet Explorer and Mozilla Firefox but
not with Opera.

Stefan
 
S

Stephen Chalmers

Stefan said:
Perhaps I have to ask my question a little bit more precise.
index.html has the frameset with two frames (frame1.html and frame2.html).
Within frame1 I'd like to reload the whole frameset (index.html) with a
JavaScript.
With parent.location.href = "index.html"; or top.location.href =
"index.html"; it works fine with Internet Explorer and Mozilla Firefox but
not with Opera.

It works for me.

What is the Opera version and O.S.?
Do you get an error in the console?
What if anything does happen?
Can you display your code?
 
S

Stefan Mueller

With parent.location.href = "index.html"; or top.location.href =
It works for me.

What is the Opera version and O.S.?
The newest version (8.5 Build 7700) for Windows (Windows 2000).
Do you get an error in the console?
No errors
What if anything does happen?
Not the expected page (index.html) gets loaded. Opera reloads the actual
page again and again.
Can you display your code?
Of course.
Actually, while trying to reproduce my problem in a simple way I figured out
that my problem doesn't happen if I use the local files. It only happens if
the files are on a web server (and like mentioned only with Opera).

Please have a look:
http://web.seekware.ch/test/frame
If you press the Next button, frame 1b will be shown but because the input
box is '0' the frameset index.html gets reloaded (because of the
JavaScript). I know this doesn't make really sense. However, in my project I
use an input box in a second frame to verify if everything is fine or if the
frameset (index.html) has to be reloaded again.
If you press several times the Next button Opera doesn't reload the frameset
(index.html) but it does reload all the time frame 1b.
(PS:If you don't experience that problem try to change the value '0' to '1'
and press Next, do a reload on the browser, go back and forward with the
browser buttons, ...)

I guess it's something like a caching problem. However, it's really very bad
because with Opera my pages sometimes gets uninterruptable reloaded.

And here's the code:
--------------------------------------------------

index.html
=======
<html>
<frameset rows = "50%, 50%">
<frame src="frame1a.html" name="MyFrame1">
<frame src="frame2.html" name="MyFrame2">
</frameset>
</html>

--------------------------------------------------

frame1a.html
=========
<html>
<body>
Frame 1a
<input type = "button" value = "Next" onClick = "document.location.href
= 'frame1b.html'">
</body>
</html>

--------------------------------------------------

frame1b.html
=========
<html>
<head>
<script type = "text/javascript">
function FormLoaded() {
if (parent.MyFrame2.document.MyForm2.MyInput2.value == 0) {
parent.location.href = "index.html";
}
}
</script>
</head>

<body onLoad = "FormLoaded()">
Frame 1b
</body>
</html>

--------------------------------------------------

frame2.html
========
<html>
<body>
<form name = "MyForm2" action = "" method = "post">
<input type = "text" name = "MyInput2" value = "0"
</form>
</body>
</html>
 
S

Stephen Chalmers

Stefan said:
Please have a look:
http://web.seekware.ch/test/frame
If you press the Next button, frame 1b will be shown but because the input
box is '0' the frameset index.html gets reloaded (because of the
JavaScript). I know this doesn't make really sense. However, in my project I
use an input box in a second frame to verify if everything is fine or if the
frameset (index.html) has to be reloaded again.
If you press several times the Next button Opera doesn't reload the frameset
(index.html) but it does reload all the time frame 1b.
(PS:If you don't experience that problem try to change the value '0' to '1'
and press Next, do a reload on the browser, go back and forward with the
browser buttons, ...)

I guess it's something like a caching problem. However, it's really very bad
because with Opera my pages sometimes gets uninterruptable reloaded.

And here's the code:
--------------------------------------------------

index.html
=======
<html>
<frameset rows = "50%, 50%">
<frame src="frame1a.html" name="MyFrame1">
<frame src="frame2.html" name="MyFrame2">
</frameset>
</html>

--------------------------------------------------

frame1a.html
=========
<html>
<body>
Frame 1a
<input type = "button" value = "Next" onClick = "document.location.href
= 'frame1b.html'">
</body>
</html>

--------------------------------------------------

frame1b.html
=========
<html>
<head>
<script type = "text/javascript">
function FormLoaded() {
if (parent.MyFrame2.document.MyForm2.MyInput2.value == 0) {
parent.location.href = "index.html";
}
}
</script>
</head>

<body onLoad = "FormLoaded()">
Frame 1b
</body>
</html>

--------------------------------------------------

frame2.html
========
<html>
<body>
<form name = "MyForm2" action = "" method = "post">
<input type = "text" name = "MyInput2" value = "0"
</form>
</body>
</html>

More likely a timing problem I think. When you perform this test:
if (parent.MyFrame2.document.MyForm2.MyInput2.value = 0)

there's no certainty that the document in frame2 is loaded, and if not
it may be triggering a reload of the *currently specified pages*.
If the purpose of this test is to ensure that frame2 is loaded, there
are probably better ways like testing first for the existence of a
variable and then the value to which it is set on load.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top