Solved

History Back Question

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

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 …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

635 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