FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/2.7.18/patches/python2-webbrowser.patch at trunk · python-emscripten/python · GitHub
python-emscripten
python
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
2.7.18
/
patches
/
python2-webbrowser.patch
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (31 loc) · 1.16 KB
Breadcrumbs
python
/
2.7.18
/
patches
/
python2-webbrowser.patch
Copy path
File metadata and controls
35 lines (31 loc) · 1.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: Support opening new browser tabs from Python/Emscripten
Forwarded: no
Author: Sylvain Beucler <beuc@beuc.net>
Last-Update: 2018-10-28
Index: Python-2.7.18/Lib/webbrowser.py
===================================================================
--- Python-2.7.18.orig/Lib/webbrowser.py
+++ Python-2.7.18/Lib/webbrowser.py
@@ -6,7 +6,7 @@
import os
import shlex
import sys
import stat
-
import subprocess
+
#import subprocess
import time
__all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"]
@@ -656,6 +656,16 @@
if sys.platform[:3] == "os2" and _iscomm
GenericBrowser(["start", "netscape", "%s"]), -1)
+
class EmscriptenBrowser(BaseBrowser):
+
def open(self, url, new=0, autoraise=True):
+
import emscripten
+
emscripten.run_script("""try { window.open('%s', '_blank'); } catch (e) { console.log(e); }""" % url.replace("'", "%27"))
+
return True
+
+
if sys.platform == 'emscripten':
+
register("emscripten", None, EmscriptenBrowser())
+
+
# OK, now that we know what the default preference orders for each
# platform are, allow user to override them with the BROWSER variable.
if "BROWSER" in os.environ:
Back
|
FazBrowse Home
|
New Git URL