I'm struggling to properly execute the window.close
function without encountering the error message below:
Scripts may close only the windows that were opened by it.
Here is the structure of my application:
HTML:
<html ng-app="mynewAPP" ng-controller="appCTRL">
....blahblah </html>
While my Angular controls are functioning well, the window.close
method doesn't seem to close the window (even though the rest of the app is running smoothly).
app.controller("appCTRL" ,function( [injections]){
$window.close();
}
How can I enable AngularJS to close the current window it is operating on?
For instance, the following script works effectively: (plain JS)
<html>
<head>
<script type="text/javascript>
function closeme(){
window.close();
}
</script></head>
<body onload="closeme()"></body>
</html>
And for those wondering how I'm accessing the page, I simply navigate to "mypage.html" in the browser. Nothing too complex.