[英]AngularJS window.close not working
I'm having trouble calling the window.close
function, without getting the following error: 我在调用
window.close
函数时遇到麻烦,而没有得到以下错误:
Scripts may close only the windows that were opened by it.
脚本只能关闭它打开的窗口。
Here is how I have my app laid out: 这是我的应用布局方式:
HTML: HTML:
<html ng-app="mynewAPP" ng-controller="appCTRL">
....blahblah </html>
My Angular controls work fine, but when I call window.close
, it is not working (at least the closing part... rest of app is fine). 我的Angular控件可以正常工作,但是当我调用
window.close
,它不能正常工作(至少关闭部分...其余的应用程序都可以)。
app.controller("appCTRL" ,function( [injections]){
$window.close();
}
How would I go about allowing AngularJS to close the window it is sitting on? 我将如何允许AngularJS关闭它所在的窗口?
For example the below script would work fine: (basic JS) 例如,以下脚本可以正常工作:(基本JS)
<html>
<head>
<script type="text/javascript">
function closeme(){
window.close();
}
</script></head>
<body onload="closeme()"></body>
</html>
For those that are wondering how I am opening the page, simply by visiting "mypage.html" on the browser. 对于那些想知道如何打开页面的人,只需访问浏览器上的“ mypage.html”即可。 Nothing fancy.
没有什么花哨。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.