Solved

History Back Question

Posted on 2004-08-16
4
352 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
ID: 11817230
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
ID: 11818273
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
ID: 11820730
use:
history.back()

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

Expert Comment

by:C7Swill
ID: 11826277
history.go(-1)

works well.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

772 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