Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[need help]load javascript in webview #110

Open
retsyo opened this issue Sep 9, 2022 · 2 comments
Open

[need help]load javascript in webview #110

retsyo opened this issue Sep 9, 2022 · 2 comments

Comments

@retsyo
Copy link

retsyo commented Sep 9, 2022

this mini html can render mermaid diagram as expected

<!DOCTYPE html>
<html>
  <body>

  <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
  <script>
   	mermaid.init({ startOnLoad: false });
  </script>

    Here is one mermaid diagram:

  <div class="mermaid">
        graph LR;
        A --> B
        B --> C
        C --Route--> A
  </div>

</body>

however, the nim code does not render the diagram

import wNim


let app = App(wSystemDpiAware)
let frame = Frame(title="wWebView", size=(640, 460))
let webView = WebView(frame, style=wWvSilent)

webView.html = """
<!DOCTYPE html>
<html>
  <body>

  <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
  <script>
   	mermaid.init({ startOnLoad: false });
  </script>

    Here is one mermaid diagram:

  <div class="mermaid">
        graph LR;
        A --> B
        B --> C
        C --Route--> A
  </div>

</body>
"""

frame.center()
frame.show()
app.mainLoop()

so what is the way to fix it? Thanks.

@khchen
Copy link
Owner

khchen commented Oct 16, 2022

wWebView in wNim use IWebBrowser2, and the last version of browser it supports is deprecated IE11.
Dose IE11 support the mermaid.js that you used? (untested)

@retsyo
Copy link
Author

retsyo commented Oct 17, 2022

So bad, it seems that IE1 does not support mermaid.js

I am asking because I met a language which claims that HTML+JavaScript can be used to realize UI( https://mp.weixin.qq.com/s/SDrzvtE6YMGmnPBqwdHtcA ), in fact, the demo gifs seem some pretty.

I tested the html page in IE 11(C:\Program Files\Internet Explorer\iexplore.exe) on win 10 64 bits
Internet Explorer restricted this webpage from running scripts or ActiveX controls.
is prompted. Even I choose enable, only

Here is one mermaid diagram: 
graph LR;A --> BB --> CC --Route--> A 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants