Javascript not work!
See original GitHub issueeel 0.12.4 Linux/Debian 9 Chrome
Hi. when i try to launch a JavaScript function from python nothing happens!
(PS. All files are located in web dir, except the file python)
html code
<html>
<head>
<script type="text/javascript" src="eel.js"></script>
<link rel="stylesheet" type="text/css" href="css/app.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0">
<title>App Login</title>
</head>
<body>
<script type="text/javascript" src="eel.js"></script>
<button onclick='eel.scan();'>Scansione</button>
<h1>Hello!</h1>
</body>
</html>
python code
# -*- coding: utf-8 -*-
import eel
import encodings
from iwlib import iwlist
eel.init('web', allowed_extensions=['.js', '.html','.css'])
@eel.expose
def scan():
result=iwlist.scan('wlan0')
for list_wireless in result:
essid=list_wireless['ESSID']
mac=list_wireless['ACCESS POINT']
channel=list_wireless['CHANNEL']
freq=list_wireless['FREQUENCY']
print '{} {} {} ({})'.format(essid,mac,channel,str(freq)[0:4])
eel.start('index.html',port=10000,size=(308, 612))
eel.sStampa()
js code
eel.expose(sStampa);
function sStampa() {
console.log('Hellooooo');
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:14
Top Results From Across the Web
Why is JavaScript not working with my HTML?
1. CTRL + SHIFT + DELETE and clear everything. 2. CTRL + SHIFT + N and new window will open so type the...
Read more >Handling common JavaScript problems - MDN Web Docs
When developers make use of new/nascent JavaScript features, modern Web APIs, etc.) in their code, and find that such features don't work in ......
Read more >Why is my Javascript not working? - html
It's document.getElementById , not document.getElementbyId . (In JS, name of variables and functions are case-sensitive).
Read more >Why Is My JavaScript Not Working? (With Examples)
If your JavaScript code is not working, the first thing you should do is check the <script> tag. When you include JavaScript in...
Read more >Chrome JavaScript not working, refreshing, or loading
Chrome JavaScript not working, refreshing, or loading · 1] Turn on JavaScript in Chrome · 2] Enable JavaScript for a specific website ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
console.log in chrome browser does work - it does something different to alert, so maybe you don’t see the output. If you open chrome’s developer tools and look at the console tab, you should see the output there.
I’m not sure what you mean by ‘how do I close an Eel window’. You can just close the browser window it opens. If you mean through code, the only supported way at the moment is to exit the program altogether (sys.exit()) as I don’t believe we track and retain the process id of the browser that gets launched.
I’m going to close this issue now as it seems you’ve got things working enough to at least use JavaScript alert.
Can you open developer console and check what error you are getting while clicking the button?