Solved

History Back Question

Posted on 2004-08-16
4
357 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
[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
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

710 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