window.close and self.close do not close the window in Chrome

后端 未结 16 2142
孤城傲影
孤城傲影 2020-11-21 05:48

The issue is that when I invoke window.close() or self.close() it doesn\'t close the window. Now there seems to be a belief that in Chrome you can\

16条回答
  •  梦如初夏
    2020-11-21 06:19

    Many people are still trying to find a way to close the Chrome browser using javascript. The following method only works when you use Chrome as APP launcher - kiosk for example!

    I have tested the following:

    I'm using the following extension: Close Kiosk

    I'm following the usage instructions and it seems to work just fine (make sure you clear the cache while doing the tests). The javascript I use is (attached to click event):

    window.location.href = '/closekiosk';
    

    I hope that helps somebody, as it's the only working solution I have found.

    Note: It seems the extension runs in background and adds a Chrome tray icon. It has the following option checked: "Let Chrome run in background" (or similar text). You may need to play with it, until it work for you. I unchecked it and now it works just fine!

提交回复
热议问题