Solved

> onclick="javascript:history.back()" not working in new window <

Posted on 2001-06-13
24
825 Views
Last Modified: 2008-01-09
Hi,

I have a site that opens up in a new window - all works Ok just that a 'BACK Button' that I have doesn't work on the new window (clears the main and bottom frames of content)but does work when I open that same page in a bog-standard IE5 window.

have a go - http://www.hotrodsandkitcars.co.uk - back button is at the top right but doesn't work in the new (full screen window) or you can go to http://www.hotrodsandkitcars.co.uk/mainindex.htm which will allow you to open up in a normal browser window and does work.

Anyone got any ideas??

0
Comment
Question by:cmuir
  • 8
  • 7
  • 5
  • +2
24 Comments
 
LVL 1

Expert Comment

by:kllewelyn
ID: 6187330
Try putting top. in front of history.back()
0
 
LVL 1

Expert Comment

by:kllewelyn
ID: 6187333
And possibly top.history.go(-1)
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6187828
New windows haven't been anywhere, so they don't have anywhere to go back TO. They're a new instance of the browser window, and don't have a history -- which is what the browser window uses for the back button.

Open in the main window, and of course, you have the history for THAT window, so you've got a BACK button.

I don't know if you can get the history for another window -- but even if you can, it's not going to change the back button on the new browser window.
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6189501
Use
  if(opener)
    opener.history.go(-1)
0
 

Author Comment

by:cmuir
ID: 6189972
Im not worried about the window that opened the new window that is just to open up the new window - its the history inside that new window I want to use.

It works if I use my back space (IE5) but not when I use javascript:history.back()

javascript:top.history.go() does work but refreshes all frames in the frameset including my top frame that includes my counter (which is bad) - I just want it to refresh the 'middle' frame like the backspace key on my keyboard does - is this possible?
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6190078
try using
     opener.top.FRAMENAME.history.go(-1)
     
     where FRAMENAME = name of the frame you are targetting to
0
 

Author Comment

by:cmuir
ID: 6190218
I just tried it

error:'opener.top' is not an object
code:0
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6190683
There is NO HISTORY for a new window.
0
 

Author Comment

by:cmuir
ID: 6190708
Not even from within that new window?

If not how can I navigate round my new window and then use my backspace to run back through the pages I have navigated around - isn't that history?

Ps - I have lost the newwindow on my site till this is resolved (just incase you look)
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6193527
Once you navigate somewhere in that window, sure you have a history. But when it first opens -- no. If you look, you'll see the back button is grayed out UNTIL you load another page.
This goes for ANY new window -- open one and see. You don't have a back button. When you access the WINDOW history object (and that's what you're accessing) it's just like hitting the back button. Not back button = no history.
0
 
LVL 1

Expert Comment

by:kllewelyn
ID: 6195537
Try:
top.framename.history.back()

framename should be the name of the frame you want to change.
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6195614
I don't think this has anything to do with frames. They were talking about a new window -- not a frame.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Expert Comment

by:kllewelyn
ID: 6195645
I'm assuming that he means after he opens the new window and clicks on something, he wants the back  to change the frame that displays the new information to return to the previous page. Obviously until he clicks on something in the new window, he won't have a history for that window.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6872879
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.  Anytime you have questions which are LOCKED with a Proposed Answer but does not serve your needs, please reject it and add comments as to why.  In addition, when you do grade the question, if the grade is less than an A, please add a comment as to why.  This helps all involved, as well as future persons who may access this item in the future to seek help.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20073867.html
http://www.experts-exchange.com/questions/Q.20077151.html
http://www.experts-exchange.com/questions/Q.20093662.html
http://www.experts-exchange.com/questions/Q.20099223.html
http://www.experts-exchange.com/questions/Q.20102607.html
http://www.experts-exchange.com/questions/Q.20103888.html
http://www.experts-exchange.com/questions/Q.20103954.html
http://www.experts-exchange.com/questions/Q.20104496.html
http://www.experts-exchange.com/questions/Q.20073596.html
http://www.experts-exchange.com/questions/Q.20134707.html
http://www.experts-exchange.com/questions/Q.20141120.html
http://www.experts-exchange.com/questions/Q.20144314.html
http://www.experts-exchange.com/questions/Q.20144320.html
http://www.experts-exchange.com/questions/Q.20147657.html
http://www.experts-exchange.com/questions/Q.20157375.html
http://www.experts-exchange.com/questions/Q.20173004.html
http://www.experts-exchange.com/questions/Q.20178986.html
http://www.experts-exchange.com/questions/Q.20231062.html
http://www.experts-exchange.com/questions/Q.20233830.html
http://www.experts-exchange.com/questions/Q.20234427.html
http://www.experts-exchange.com/questions/Q.20237331.html
http://www.experts-exchange.com/questions/Q.20241979.html
http://www.experts-exchange.com/questions/Q.20102555.html
http://www.experts-exchange.com/questions/Q.20262558.html
http://www.experts-exchange.com/questions/Q.20274450.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.20276466.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

Moderators will finalize this question if still open in 7 days, by either moving this to the PAQ (Previously Asked Questions) at zero points, deleting it or awarding expert(s) when recommendations are made, or an independent determination can be made.  Expert input is always appreciated to determine the fair outcome.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 

Author Comment

by:cmuir
ID: 6876886
Still waiting for response - question may have got confused in the conversation though
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6877032
You got your response -- a new window has NO HISTORY. You haven't gone anywhere. History is for the WINDOW, not the BROWSER. Go somewhere IN THAT WINDOW, and you'll have a history -- but for THAT WINDOW ONLY.

And if your new window has FRAMES, the back button will work the same way ANY back button works in a frameset (badly), but will NOT even be active UNTIL YOU GO SOMEWHERE WITHIN THAT WINDOW.
0
 
LVL 1

Expert Comment

by:kllewelyn
ID: 6877049
Did you try:

top.history.go(-1)
0
 

Author Comment

by:cmuir
ID: 6877127
Webwoman

Yes I know there is no history between windows

"Im not worried about the window that opened the new window that is just to open up the new window -
its the history inside that new window I want to use.

It works if I use my back space (IE5) but not when I use javascript:history.back()"

I know I have to go somewhere to create history and when I have the backspace works fine but history.back and history.go don't do the same as my backspace.

C
0
 

Author Comment

by:cmuir
ID: 6877130
kllewelyn

sure i did try it - will have another go though to confirm either way

Cheers

Charlie
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6878824
You're missing the point -- if you have frames in that new window, the history command (especially if you use top.history(-1)) will work the way it does for frames. Which is -- pretty badly.

And if you have frames and use top.history(-1), you won't get anything, because THAT doesn't HAVE a history.

Are you using frames in the new window? And remember, this script has to be in some page AFTER you initially open the window -- the page you use when you open the window has no history.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6887509
Charlie, please return here and update webwoman on her last entry of 3/18/02, seeing as you logged in 3/20/02.
Thanks,
Moondancer - EE Moderator
0
 

Author Comment

by:cmuir
ID: 6888195
Yes I have frames in the new window and it is sounding like I will have to put it down to the 'way frames work'
0
 
LVL 19

Accepted Solution

by:
webwoman earned 45 total points
ID: 6889447
Then that's the problem. Nothing to do with the javascript, or the history. Everything to do with the frames. ;-)
0
 

Author Comment

by:cmuir
ID: 6893552
cheers

Charlie
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now