473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Back button / iframe problem

Hi,

I have a directory with a file main.htm:

<html><body>
<p><iframe src=i.htm></iframe></p>
<p><a href="javascript:history.back()">Back</a></p>
</body></html>

and a file i.htm:

<html><body>
Content
</body></html>

The application can load main.htm in 5 different ways (always using
another frameset).

The 'Back' button should always affect main.htm (never i.htm). But I
cannot find a way to make this work, unless I start hardcoding on the
frame names/DOM themselves. But I want to avoid that, because the
applicability of main.htm must be ensured in all kind of (future)
framesets, and I don't want to modify main.htm every time for each new
frameset. Also, I can not rely on the frame name that main.htm might
(or might not) get from a parent.

I tried things like

self.history.back
window.history.back
...

but they go to the previous page of i.htm, not that of main.htm (unless
i.htm is "out of previous pages", so to say, then it goes to the
previous page of main.htm).

Any workarounds ?

Thanks,

--
Bart

Dec 14 '05 #1
2 9825
Bart Van der Donck said the following on 12/14/2005 3:22 PM:
Hi,

I have a directory with a file main.htm:

<html><body>
<p><iframe src=i.htm></iframe></p>
<p><a href="javascript:history.back()">Back</a></p>
</body></html>

and a file i.htm:

<html><body>
Content
</body></html>

The application can load main.htm in 5 different ways (always using
another frameset).

The 'Back' button should always affect main.htm (never i.htm). But I
cannot find a way to make this work, unless I start hardcoding on the
frame names/DOM themselves. But I want to avoid that, because the
applicability of main.htm must be ensured in all kind of (future)
framesets, and I don't want to modify main.htm every time for each new
frameset. Also, I can not rely on the frame name that main.htm might
(or might not) get from a parent.

I tried things like

self.history.back
window.history.back


parent.history.back();

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 14 '05 #2
Randy Webb writes:
Bart Van der Donck said the following on 12/14/2005 3:22 PM:
I have a directory with a file main.htm:

<html><body>
<p><iframe src=i.htm></iframe></p>
<p><a href="javascript:history.back()">Back</a></p>
</body></html>

and a file i.htm:

<html><body>
Content
</body></html>

The application can load main.htm in 5 different ways (always using
another frameset).

The 'Back' button should always affect main.htm (never i.htm). But I
cannot find a way to make this work, unless I start hardcoding on the
frame names/DOM themselves. But I want to avoid that, because the
applicability of main.htm must be ensured in all kind of (future)
framesets, and I don't want to modify main.htm every time for each new
frameset. Also, I can not rely on the frame name that main.htm might
(or might not) get from a parent.

parent.history.back();


My tests show the following results for your suggestion (XP IE6):

1. If main.htm is in a frameset:

parent.history.back() goes to the previous page of main.htm's parent
(not to the previous page of main.htm itself). So just history.back()
would be better than parent.history.back(), because history.back()
affects by default the document from which it was invoked ("self").
Also, the surrounding frameset is mostly from another domain name, so I
get a js error.

2. If main.htm is not in a frameset:

Same behaviour as history.back()

Thanks again

--
Bart

Dec 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Javier | last post by:
Hello, I'm very new in this forum and as I have the following problem, the website is in http://new.vanara.com ----------------------------------------------------------------------------...
3
by: Nick Tew | last post by:
Hi, Firstly, any help would be gratefully received. Im using several iframes on a single page and would like individual 'back' and 'forward' buttons located in each of the iframes which only...
4
by: PiedmontBiz | last post by:
Greetings I have written an online survey with 110 questions. I use javascript to cycle thru all the questions which are displayed in an iframe. I keep track of the question number using a...
8
by: Rose Chambers | last post by:
How can I insert preformatted text from a file on the web server into a table's cell? And then swapped the text in response to an onClick event. Something like this......... <table>...
1
by: Johan Nedin | last post by:
Hello! I am having a problem with the @OutputCache page directive and Web browser Back Buttons. Problem: After setting <%@ OutputCache Location="None" %> on my pages I get the "Warning!...
2
by: jieelee | last post by:
Hi, I am Jieun I am working on e-mail redirecting for preventing email harvesting using iframe. When clicking on email and then click on another link on the page. Then press back button, the...
6
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.