Solved

window.history  with frames

Posted on 1998-08-13
4
222 Views
Last Modified: 2006-11-17
I've been trying to do the following in VBscript, but there's no vbscript section here... so maybe javascript's the way to go:)...
I have two frames... a menu (bottom frame) and a content frame (top frame).  In the menu, I have a "back" button... this button should use: window.history back 1 and target that to the top frame.  I've tried this a bunch of different ways- but I can't seem to have the top frame update with the last URL in the browser's history list.

any help would be most appreciated.

TIA,
Adam
0
Comment
Question by:adamr
  • 2
4 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1268249
If you want the top frame to display the previous document that was in the bottom using history, i think that is not possible.
For security reasons history elements can not be read, and can not be transferred from one frame to another.

So if you want to find out where the visitors from your website came from, you can't do that using history.
0
 
LVL 8

Expert Comment

by:jbirk
ID: 1268250
did you try simply using "history.go(-1);"?  This will go back one in the history list.  However if that is just a change of the contents of one frame it will only change that one frame and not the entire document.  If you wanted to go further back in order to get past that frame activity you could use history.go(-2) or -3 or however many is necesary, but you can't see the value of the urls in the history if they came from a different url for security reasons as sybe has pointed out.

You can use document.referrer to get where the user linked to you from.  And with that you could set "top.location=top.document.referrer;" to go back, but this will only work if they linked to your page.  If they typed it in or used a bookmark document.referrer is empty.
-Josh
0
 

Accepted Solution

by:
talklein earned 100 total points
ID: 1268251
here is the script for this buttons (Back and Forward).
(you can put just one button.)
then you can put the code of any button (change the FRAME TARGET NAME to the name of your frame).


<FORM>

<INPUT TYPE="button" VALUE="BACK" onClick="parent.FRAME TARGET NAME.history.back()">

<INPUT TYPE="button" VALUE="FORWARD" onClick="parent.FRAME TARGET NAME.history.forward()">




tal.





0
 
LVL 8

Expert Comment

by:jbirk
ID: 1268252
any news adamr?
Did we help you, or do you need further assitence?
-Josh
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question