简体   繁体   中英

Page redirection and close the window are not working in firefox

I wrote the following code to redirect the user to different pages and close the window. While the following code works fine in chrome, but it does not work in firefox.

function OnRequestComplete(result) {
            if (result != null) {
                window.returnValue = true;
                var myhref = '';
                myhref = result;
                window.opener.top.location.href = myhref;
                window.close();
                }
        }

use this for redirection:

 window.location.href = myhref;

If you want to close a window on firefox, use this:

top.window.close()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM