?
Solved

window.history  with frames

Posted on 1998-08-13
4
Medium Priority
?
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…
Suggested Courses

777 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