Forum Moderators: open

Message Too Old, No Replies

IE and popUp windows

Closing pop up and redirecting parent!?!@!

         

giggle

9:55 am on Nov 9, 2010 (gmt 0)

10+ Year Member



Hi

We have a requirement that will allow a user to click to open a pop up to supply information. Depending on what the customer does I'd like to be able to close the pop up and redirect the parent window to a different URL.

What I've done works in Firefox but will not in IE.

Is it evident from this where my problem is:

Parent screen:

function popUp(url,h,w)
{
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var title = "POPPING UP NOW";
var newWindow = window.open (url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}


Inside the pop up (after a form has been filled the customer gets redirected to page that does the close/redirect):

function Redirect()
{
window.opener.location="http://www.example.co.uk/elsewhere.asp"
window.close();
}


As I say, it works fine in FF but not in IE. In IE the windown pops up but when the user submits the form, the window stays open and the window gets redirected to the new page.

Any ideas please?

Thanks

Mick

Fotiman

2:06 pm on Nov 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It works for me in IE7. However, I needed to fix the "title" (removed the spaces because it wouldn't create the new window otherwise). So "POPPING UP NOW" I changed to "POPPINGUPNOW".

giggle

10:50 am on Nov 10, 2010 (gmt 0)

10+ Year Member



Still couldn't get it work work (even changing the title). I've ended up doing it like this:


parentLocation="http://www.example.co.uk/elsewhereasp"

// Check if Firefox or not
var browserName=navigator.appName;

if (browserName=="Netscape")
{
// works in Firefox so use it
window.opener.location = parentLocation;
window.close();
}
else
{
// maximize pop up and move to destination
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);
window.location = parentLocation;
}



It'll do for now. Thanks for the help.