Page 1 of 1
Make an iframe go back?
Posted: Fri May 18, 2007 11:12 pm
by toasty2
I'm trying to get an iframe (and not the whole webpage) to go back, like history(-1). Everything I've tried hasn't worked. Could someone show me a working example?
Posted: Fri May 18, 2007 11:42 pm
by Kieran Huggins
window.frames['frameName'].history(-1) I believe... though untested
Posted: Fri May 18, 2007 11:48 pm
by toasty2
It doesn't work
I also tried using window.frames.frameName.history(-1). (frameName being the frame of course)
Posted: Sat May 19, 2007 12:02 pm
by toasty2
I'll give some more details.
I have an iframe with a name and id of "o". The following things don't work:
Code: Select all
<a href="#" onclick="window.frames.o.history.go(-1);">back</a>
<a href="#" onclick="window.frames.o.history.back();">back</a>
<a href="#" onclick="window.frames['o'].history.back();">back</a>
Am I doing it wrong?
Posted: Sat May 19, 2007 1:07 pm
by Ollie Saunders
how about something along the lines of
Code: Select all
document.getElementsByTagName('IFRAME')[0].history.go(-1);
Posted: Sat May 19, 2007 2:00 pm
by toasty2
Doesn't work. Why don't any of these work? A website even used two of those as examples!
Posted: Sat May 19, 2007 3:21 pm
by Ollie Saunders
OK try:
document.getElementsByTagName('IFRAME')[0].history.back();
Posted: Sat May 19, 2007 3:36 pm
by Kieran Huggins
works in FF but not in IE - IE seems to deny you control of the frame if it's containing info from another domain

Posted: Sat May 19, 2007 4:17 pm
by toasty2
At least it works at all. I use Firefox, so that'll work (this is for my own personal website...I'm not insanely concerned about IE)