Isaac Li
Isaac Li

Reputation: 155

How to add a close button to a newly opened window in ionic for an android device?

I have code like this:

$scope.viewOrderDetails = function viewOrderDetails(detail) {
    var newWin = open('orderdetails.html','windowName','height=300,width=300');
    newWin.document.write('html to write...');
    newWin.document.write(detail);
    //<input type="button" value="Close this window" onclick="self.close()">
}

I want to add close button to newWin. How can I achieve that? Thanks.

UPDATED:

newWin.document.write('<input type="button" value="Close this window" onclick="window.close()">');

it works in ionic serve, but when running in my pad device, when i click "Close this window", the window can not be closed.

Upvotes: 3

Views: 893

Answers (1)

The answer is in your question itself...you can try this...

newWin.document.write('<input type="button" value="Close this window" onclick="window.close()">');

Upvotes: 2

Related Questions