Solved

History Back Question

Posted on 2004-08-16
4
347 Views
Last Modified: 2008-03-06
Hi, I have the following code that opens a window

function messageWindowsec(from, to)
{
  var width="600", height="250";
  var left = (screen.width/2) - width/2;
  var top = (screen.height/2) - height/2;
  var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
  var msgWindow = window.open("","msgWindow", styleStr);
  var head = '<head><title>NAC Music</title></head>';
  var body = '<center><font  color="#993399"><b>Select Hymn to Dowload<b></font><br>';
  msgWindow.document.write(head + body);
 msgWindow.document.write('<table><tr><td>');
  for (i=from;i<to;i++)
        {
       msgWindow.document.write ('<a href="NACMusicHymnsListen.asp?varsound=' + i + 'mid">' + i + '</a>' + ' ');
        }
 
   msgWindow.document.write('</td></tr></table>');
   msgWindow.document.write('<a href="" onclick="self.close()">Close Window</a>');
}

I open NACMusicHymnListen.asp passing it the required parameters. On this page i have  a close nutton, and I would like it to navigate back to the first page(Open via window.open method). I use (window.history(-1), but it cannot find the prev page..

THANKS
0
Comment
Question by:xy15973
4 Comments
 
LVL 7

Accepted Solution

by:
suramsureshbabu earned 500 total points
Comment Utility
if you are openin up a new window then it will not be having any history so it will not be able to go back. if you open the new page in the same window then only history .back will work as  there will be pages in history

suresh :)
0
 
LVL 3

Expert Comment

by:Fairco
Comment Utility
If I understood correctly, you want to close the new window AND make the parent window step back in the history list.
If so, use the following line for the Close Button link:

 msgWindow.document.write('<a href="" onclick="window.opener.history.back(-1);self.close()">Close Window</a>');
0
 
LVL 8

Expert Comment

by:GEM100
Comment Utility
use:
history.back()

instead of:
window.history(-1)
0
 
LVL 1

Expert Comment

by:C7Swill
Comment Utility
history.go(-1)

works well.
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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to dynamically set the form action using jQuery.

762 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

15 Experts available now in Live!

Get 1:1 Help Now