Forum Moderators: open

Message Too Old, No Replies

Safari & Internet Explore Popup Javascript

         

talie

2:38 am on Aug 16, 2005 (gmt 0)

10+ Year Member



I have a splash page which can open another html page or a popup window containing a Flash movie. The Flash movie provides an alternative access point for the html pages (these open in a new window). So if a user goes via the Flash movie it is possible to have a total of 3 windows open - the splash page window, the Flash window, and the content window.

My problem:
If the user goes via the Flash movie and opens a content page then they can get to any of the other content pages via a side menu. This is fine, and if they hit my Back button they can get back to the previous content pages. However, when they get to the page Flash first opened then I want the content window to close (on the next click of the Back button). I also need to account for anchors in the original page which doesn't seem to update the location object that is accessible by javascript.

The code I'm currently using works great in Windows Internet Explorer but in Mac Internet Explorer my Back button can go back through the History stack but doesn't close the window. Safari doesn't even go back through the History stack! I know javascript is working in the popup content window because I have image rollovers which work but my Back function isn't getting called in Safari.


function Back() {
alert("window.opener='" +window.opener +"'");
window.history.back();

if(isWin) {
//this works great on Windows!
if(window.opener!= null && window.opener.name == "flashpg" && window.opener.entryNum <= 0) {
window.close();
}
else {
if(window.opener!= null && window.opener.name == "chilloutRoom") {
window.opener.entryNum = window.opener.entryNum-1;
}
}
}
else {
//Mac code
if(window.opener!= null) {
if(window.opener.name == "flashpg" && window.opener.entryNum <= 0) {
window.close();
}
else {
if(window.opener.name == "flashpg") {
window.opener.entryNum = window.opener.entryNum-1;
}
}
}
}
}

Can you update a variable in the opener window in Safari and Mac Internet Explorer?
Any ideas why the Back button may not be calling the my function?

It should be noted that when the content pages are opened directly from the splash page (that is not via the Flash movie) then my Back buttons work fine and call the function. The exact same file is being used in both instances.

garann

6:26 pm on Aug 16, 2005 (gmt 0)

10+ Year Member



As to the problem with your Back button, does it help to replace
 window.history.back()
with
history.go(-1)
?