Reputation: 1750
I'm having trouble calling the window.close
function, without getting the following error:
Scripts may close only the windows that were opened by it.
Here is how I have my app laid out:
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).
app.controller("appCTRL" ,function( [injections]){
$window.close();
}
How would I go about allowing AngularJS to close the window it is sitting on?
For example the below script would work fine: (basic 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. Nothing fancy.
Upvotes: 0
Views: 8583