Solved

History Back Question

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WPF issue with Trigger 2 96
Can I Use Microsoft Access to Connect to an MS SQL Backend on a webhost? 5 77
Menu Inconsistent 3 34
ebay seller html tags 2 5
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
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).

896 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

13 Experts available now in Live!

Get 1:1 Help Now