+ 2

Can you close a window in javascript using the window.close() method?

Lets say you did not open the window using js methid window.open(), can you still close it using the window.open(' ', '_self').close() method? Or is there another method to close the window, considering you want to close it using a button that returns the close function, can you close it? Please explain.

19th Dec 2019, 1:50 PM
Alfred Juma
Alfred Juma - avatar
3 Antworten
+ 1
Try this bro: <a href="self.close"><button>Close</button></a>
21st Dec 2019, 10:12 PM
Thống Nguyễn
Thống Nguyễn - avatar
+ 3
Worked.. thanks man
2nd Jan 2020, 9:01 PM
Alfred Juma
Alfred Juma - avatar
+ 1
Alfred Juma please to help you!
2nd Jan 2020, 11:14 PM
Thống Nguyễn
Thống Nguyễn - avatar