admin管理员组

文章数量:1302930

window.close();//false

window.open(location, '_self', '');
window.close();//false

open(location, '_self').close();//false

Chrome 45.0.2454.85 m, Firefox also has the problem.

Please help...

Console option screenshot

window.close();//false

window.open(location, '_self', '');
window.close();//false

open(location, '_self').close();//false

Chrome 45.0.2454.85 m, Firefox also has the problem.

Please help...

Console option screenshot

Share Improve this question edited Mar 11, 2016 at 9:07 Keefe asked Mar 11, 2016 at 9:05 KeefeKeefe 311 gold badge1 silver badge4 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 3

You should store your opened window in a variable.

var popup = window.open(location, '_blank', '');
popup.close();

EDIT: Opening in _self does not work since you open a new page in the same screen, you might want to do _blank like i've edited.

本文标签: javascriptChrome “Scripts may close only the windows that were opened by it” errorStack Overflow