Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 850
Isaac Li Avatar asked Jan 22 '26 08:01

Isaac Li


1 Answers

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

newWin.document.write('<input type="button" value="Close this window" onclick="window.close()">');
like image 91
Anandhakumar Subramaniam Avatar answered Jan 24 '26 04:01

Anandhakumar Subramaniam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!