question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Is it possible to update the HTML being displayed?

See original GitHub issue

Please excuse me if it’s faux pas to ask a question in issues.

The way I’m using web-view is reading a few files, building a html-table and feeding that to web-view with

    let size = (900, 778);
    let resizable = false;
    let debug = true;
    let init_cb = |_webview| {};
    let frontend_cb = |_webview: &mut _, _arg: &_, _userdata: &mut _| {};
    let userdata = ();
    run(
        "WR-stats",
        Content::Html(html),
        Some(size),
        resizable,
        debug,
        init_cb,
        frontend_cb,
        userdata,
    );

Eventually I want to listen for changes in a file, and if there are reread that file and rebuild the html. Is it possible to simply swap out the html being displayed with this new rebuilt html?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
quadrupleslapcommented, May 8, 2018

@eedahl you can use web_view::escape to safely pass strings to JavaScript now, but it hasn’t been published to crates.io.

0reactions
phasecommented, Apr 15, 2019

Using this

webview.eval(format!("document.documentElement.innerHTML=String.raw`{}`", YOUR_HTML).unwrap();

looks like it works fine, but I did notice that only the JS in my original HTML was being parsed for some reason. I’m not sure if that’s a side effect of this or webkit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browsers does not reflects updates in the code - html
I know this is a very old topic, but Firefox still fails to show code changes after refreshing a page, then viewing the...
Read more >
Handling common HTML and CSS problems - MDN Web Docs
Objective: To be able to diagnose common HTML and CSS cross browser problems, and use appropriate tools and techniques to fix them.
Read more >
Structural markup and right-to-left text in HTML - W3C
This article looks at ways of handling text direction for structural markup in HTML, ie. at the document level and for elements like ......
Read more >
HTML pre tag - W3Schools
The <pre> tag defines preformatted text. Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces...
Read more >
Formatting Questions - Qualtrics
Normal View: This is the default mode of editing. This view does not have as many formatting options as the rich content editor,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found