Problem loading local html
See original GitHub issueSpecification
- Platform: macOS
- Version: 10.13.6
Description
Hi,
I’ve just started using pywebview and am having trouble loading/linking local html/css/js files.
webview.create_window('Test', 'assets/index.html')
only shows a white screen whereas
def load_html():
with open('assets/index.html') as html:
webview.load_html(str(html.read()))
if __name__ == '__main__':
t = threading.Thread(target=load_html)
t.start()
webview.create_window('Test')
doesn’t load the image or stylesheet referenced in the HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta charset="utf-8"/>
</head>
<body bgcolor="#0099ff">
<div align="center">
<img src="images/logo.jpg">
<h1>TEST</h1>
</div>
</body>
</html>
I’m probably missing something very obvious, any help is appreciated. Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Why isn't my local index.HTML file loading in my browser?
You have your website or pages set to 'noindex '. One of the first things I look for when a page or website...
Read more >Local HTML file not loading CSS file in browser - Stack Overflow
Local HTML file not loading CSS file in browser - Stack Overflow. Stack Overflow for Teams – Start collaborating and sharing organizational ...
Read more >Webview load local html - Visual Studio Feedback
i use web.Navigate(new Uri(“ms-appx:///sample.html”)); load local html; Report an error:System.Exception: “Aborted operation (Exception from HRESULT: ...
Read more >CSS not loading on local html file - Reddit
I think it is related to the css path you providing on that site. When you are doing it on your local machine...
Read more >Load Local HTML File or URL in React Native using react ...
You have to make 2 copies of the HTML file and have to put them on a different location for Android and IOS....
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
Or pass
debug=True
as an argument tocreate_window()
and on the white screen try Control Click -> Inspect Element to inspect the webview.Great! Thanks for helping figure it out. 👍