Skip to content

[ios] HtmlWebViewSource.BaseUrl is applied with an unexpected prefix #19792

Done

Description

@dodikk

Description

Setting HtmlWebViewSource.BaseUrl results in different window.location.href on iOS and Android respectively.

  • Android ==> BaseUrl is applied as is
  • iOS ==> some file://...<appBundle>.../... prefix is mixed with BaseUrl value which breaks some of the page content.

ACTUAL RESULT (from debug alert() javascript logs)

Android:
Screenshot 2024-01-09 at 19 56 24

iOS:
Screenshot 2024-01-09 at 19 58 09

EXPECTED RESULT
window.location.href is equal to HtmlWebViewSource.BaseUrl on both platforms

Steps to Reproduce

private static string BaseUrlForCaptcha => "https://identity-dev.coinpaymints.com";

// then in ctor() of ContentView
{
    PlainWebviewHtmlSource.BaseUrl = BaseUrlForCaptcha;
    PlainWebviewHtmlSource.Html = pageContentsHtml;
}

// then in onload() in pageContentsHtml
alert(window.location.href);

Link to public reproduction project repository

https://github.com/dodikk/bug-maui-webview-baseurl

Version with bug

7.0.101

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

No response

Did you find any workaround?

No workaround found

So an important sign-up (aka "register") flow of my app is broken.

Relevant log output

No response

Activity

  1. added
    t/bug
    on Jan 9, 2024
  2. added
    s/needs-repro
    on Jan 9, 2024
  3. ghost added
    legacy-area-controls
    on Jan 9, 2024
  4. dodikk commented on Jan 9, 2024

    @dodikk
    Author

    Here is a minimal sample link as requested
    https://github.com/dodikk/bug-maui-webview-baseurl

  5. ghost added
    s/needs-attention
    on Jan 9, 2024
  6. ghost removed
    s/needs-repro
    on Jan 9, 2024
  7. dodikk commented on Jan 10, 2024

    @dodikk
    Author

    The native WKWebView of iOS sdk shows the baseUrl as expected.
    So it seems like MAUI is modifying it under the hood for some reason. So please add a flag to disable that behaviour when needed.

    Screenshot 2024-01-10 at 15 10 31

    [upd] same results for the UIWebView native control

    p.s. the native sample is in the same repository
    https://github.com/dodikk/bug-maui-webview-baseurl

  8. dodikk commented on Jan 10, 2024

    @dodikk
    Author

    Seems like NSBundle.MainBundle.BundlePath is concatenated with the value provided by me.

    However, i am unable to find that in maui codebase
    https://github.com/search?q=repo%3Adotnet%2Fmaui+%22NSBundle.MainBundle.BundlePath%22&type=code

  9. added this to the Backlog milestone on Jan 11, 2024
  10. added
    s/verified
    s/triaged
    on Feb 6, 2024
  11. 27 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-webviewplatform/ioss/triageds/verifiedt/bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions