Skip to content

loading html content as a single string #326

@namini40

Description

@namini40

hi. thanks a lot for such amazing work of yours and all contributors.

i have HTML content which is coming from the server as string value. i want to load it inside the webview. it contains some scripts on top. basically something like this:

            <html>
            <head>
                <script src="https://example.com/external.js"></script>
                <img src="https://example.com/image.png" />
            </head>
            <body>
                <h1>Test Content</h1>
                <script>
                    console.log('Page loaded, trying to load external resource...');
                    // Force a request that should trigger the interceptor
                    var img = new Image();
                    img.src = 'https://httpbin.org/get?test=interceptor';
                    img.onload = function() { console.log('External image loaded'); };
                    img.onerror = function() { console.log('External image failed'); };
                </script>
            </body>
            </html>

Main Issue (android)

  • RequestInterceptor does not gets called (not at all, tested for lots of content, searched throughout the examples)
  • it tries to load the html and remains in loading state until network timeout. then ignores the script and loads the html only.
  • tested with other methods, interceptor works fine.
  • as suggested in the docs (README):

Developers can load HTML data in the following way...

but in the WebViewState.kt file on the method doc says:

@param data The uri to load in the WebView

this seems to be a mistake or i am missing something?

thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions