-1

I would like to create a website that when a button is clicked, the browser(and not only one tab) closes.

I thought to create a button inside a form that calls the python function

e.g [for html]:

<form action=?? method="GET">
     <input type="submit" value="close browser">
</form>

e.g [for python]:

import webbrowser

def close_browser():
  webbrowser.close()
  return None

How could I call the close_browser() function from html/JavaScript?

1 Answers1

2

For the time being, Python is not a client-side (browser) scripting language. It's javascript or coffeescript or some other options... .

When it comes to javascript, your question is a duplicate from:

Is it possible to close a browser window using javascript?

Community
  • 1
  • 1
Rolf Schorpion
  • 523
  • 1
  • 4
  • 12