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

Html from Local File in Windows #5523

Closed
ThomasDallmeier opened this issue Mar 23, 2022 · 11 comments · Fixed by #5539 or #7672
Closed

Html from Local File in Windows #5523

ThomasDallmeier opened this issue Mar 23, 2022 · 11 comments · Fixed by #5539 or #7672
Assignees
Labels
area-controls-webview WebView fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! fixed-in-6.0.408 Look for this fix in 6.0.408! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@ThomasDallmeier
Copy link

Description

Hello, local files are not displayed under windows. If you work like described in the documentation, local files are displayed in Android, but not in windows.

Steps to Reproduce

Try it like described in the documentation

Version with bug

Preview 14 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Latest Win 11

Did you find any workaround?

no

Relevant log output

No response

@ThomasDallmeier ThomasDallmeier added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Mar 23, 2022
@Eilon
Copy link
Member

Eilon commented Mar 23, 2022

@ThomasDallmeier can you show the code of how you were trying to use a local file?

@Eilon Eilon added the s/needs-info Issue needs more info from the author label Mar 23, 2022
@ghost
Copy link

ghost commented Mar 23, 2022

Hi @ThomasDallmeier. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@ThomasDallmeier
Copy link
Author

ThomasDallmeier commented Mar 24, 2022

Hello here is the code:

  <WebView x:Name="webview" >
            <WebView.Source>
                <HtmlWebViewSource>
                    <HtmlWebViewSource.Html>
                        <![CDATA[
                <html>
                <head>
                </head>
                <body>
                <h1>.NET MAUI</h1>
                <p>The CSS and image are loaded from local files!</p>
                <p><a href="WebHelp/index.htm">next page</a></p>
                </body>
                </html>                    
                ]]>
                    </HtmlWebViewSource.Html>
                </HtmlWebViewSource>
            </WebView.Source>

        </WebView>

        <StackLayout Orientation="Horizontal" Grid.Row="1">

            <Entry x:Name="input" WidthRequest="150" Margin="12" Text="DrExplain/index.htm"/>

            <Button Margin="12" Text="Load" Clicked="Button_Clicked" HeightRequest="38" WidthRequest="150" />

        </StackLayout>

I add a screenshot for the project

image

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Mar 24, 2022
@ThomasDallmeier
Copy link
Author

And here is a part of the project file:

<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> </ItemGroup>

@shimingsg
Copy link

verified repro with vs 17.2.0 Preview 3.0 [32323.346.main], but it works fine in Android 11 emulator
demo:
MauiApp5523.zip

on Windows:
image

on Android works fine:
image

@shimingsg shimingsg added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Mar 24, 2022
@jfversluis jfversluis added platform/windows 🪟 area-controls-webview WebView and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Mar 24, 2022
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Mar 24, 2022
@jsuarezruiz jsuarezruiz self-assigned this Mar 24, 2022
@ThomasDallmeier
Copy link
Author

Hello, the example works with a very simple html file. But not with a complex webhelp project. Please see the two screenshot, with the complete different result. I think it is not just a problem with thw missing hightrequest.

Here is the complete webhelpview on android:

image

This ist the incomplete result on windows:

image

@ThomasDallmeier
Copy link
Author

ThomasDallmeier commented Mar 25, 2022 via email

@Eilon Eilon reopened this Mar 25, 2022
@Redth Redth added this to the 6.0.300-rc.3 milestone Mar 31, 2022
@samhouts samhouts removed the s/needs-attention Issue has more information and needs another look label Apr 21, 2022
@Redth Redth modified the milestones: 6.0.300-rc.3, 6.0.300 Apr 27, 2022
@davidortinau davidortinau added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Apr 29, 2022
@Redth Redth added p/2 Work that is important, but is currently not scheduled for release and removed p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint labels May 3, 2022
@samhouts samhouts modified the milestones: 6.0.300, 6.0.300-servicing May 6, 2022
@breenbob
Copy link
Contributor

breenbob commented May 31, 2022

I've just tried this with a simple HTML page that sets the background colour to red using Maui GA release with 17.3.0 Preview 1.1 and I get same issue on Windows. Even the sample straight from the Maui WebView docs of loading a simple HTML page by clicking a hyperlink does not work. The inline HTML loads fine, the external file returns a failure in OnNavigated and just loads about:blank page. All files I've tried this with were set as MauiAssets in the properties, and they all copied to the target directory OK. This is a pretty major issue as prevents loading up of client side apps, which with WebView2 on WinUI was going to be huge for us. Any timeline for a fix? Will check iOS when I get a chance.

@breenbob
Copy link
Contributor

To be clear, with the GA release I can't get it to load any local files, not even a simple HTML page:
image
image
image
image
image

@breenbob
Copy link
Contributor

breenbob commented Jun 1, 2022

I've submitted a PR for this which resolves the issue for me on WinUI3. I tested with a simple web page first, and a more complex client side app after. I commented on there that there are 2 parts to this issue highlighted by my testing, 1) the implementation in MauiWebView on Windows, and; 2) an issue in the WebView2 control when loading more complex client-side applications. The latter is resolved if you install Edge from the Beta channel, so I can only assume the underlying issue is fixed and will be included in the next WebView2 release. Assume this shouldn't prevent merging of the PR though as code still valid.

It's my first PR to Maui, so hope it's OK!

@samhouts samhouts added the partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with label Jun 14, 2022
breenbob pushed a commit to breenbob/maui that referenced this issue Jun 19, 2022
breenbob pushed a commit to breenbob/maui that referenced this issue Jun 20, 2022
breenbob pushed a commit to breenbob/maui that referenced this issue Jun 21, 2022
rmarinho pushed a commit that referenced this issue Jun 21, 2022
* Fix for #5523 MauiWebView not loading local files on Windows

* Unpackaged app support for local HTML files.

* Use property for path

* Auto map/unmap virtual host for app dir when navigating to safe/unsafe URIs

Co-authored-by: Conor Breen <[email protected]>
@rmarinho
Copy link
Member

fixed by #7672 7672

@ghost ghost locked as resolved and limited conversation to collaborators Jul 22, 2022
@samhouts samhouts added p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint and removed p/2 Work that is important, but is currently not scheduled for release labels Jul 22, 2022
@samhouts samhouts added fixed-in-6.0.408 Look for this fix in 6.0.408! fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! labels Feb 17, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-webview WebView fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! fixed-in-6.0.408 Look for this fix in 6.0.408! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/cat 😻 this is an issue that impacts one of our partners or a customer our advisory team is engaged with platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
10 participants