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

Enhancement Request: Support for Desktop Refresh without 404 Errors #57

Open
HelloooJoe opened this issue Mar 27, 2024 · 1 comment
Open

Comments

@HelloooJoe
Copy link

Description

When using the HybridWebView experiment in a .NET MAUI application on a desktop platform, refreshing the page leads to a 404 error. This issue affects the usability and the user experience, especially during development and testing phases.

Steps to Reproduce

  1. Run a .NET MAUI application that uses HybridWebView on a desktop platform.
  2. Navigate to any content within the HybridWebView that loads from a local or proxied resource.
  3. Refresh the page.
  4. The application shows a 404 error page instead of reloading the current content.

Expected Behavior

The application should reload the current page/content within the HybridWebView without any errors, preserving the user's state and context where applicable.

Actual Behavior

The application fails to find the requested page after a refresh and displays a 404 error, indicating that the resource cannot be found.

Possible Solutions or Suggestions

  • Implement a mechanism to handle refresh actions within the HybridWebView control, potentially by caching the last loaded URL or state and attempting to reload it upon a refresh action.
  • Investigate if the issue is related to the way routing is handled within the .NET MAUI application or the underlying web view control and propose a solution to maintain routing context across refreshes.

Question

Is handling refresh actions on the desktop within the scope of the HybridWebView control, or should it be managed at the application level? Any guidance on best practices or recommendations would be greatly appreciated.

Environment

  • .NET MAUI version: [8.0.10]
  • Platform Target Frameworks:
    • Desktop: [Windows/MacOS version]
  • Relevant plugins or packages: EJL.MauiHybridWebView [1.0.0-preview6]

Additional Context

Add any other context or screenshots about the enhancement request here.

image

@MarkSky
Copy link

MarkSky commented Sep 6, 2024

I have the same error on Android Devices.
MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:EZTestMauiApp"
             xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
             xmlns:ejl="clr-namespace:HybridWebView;assembly=HybridWebView"
             x:Class="EZTestMauiApp.MainPage"
             BackgroundColor="#ffffff">

    <ContentPage.Behaviors>
        <toolkit:StatusBarBehavior StatusBarColor="#000000" StatusBarStyle="Default" />
    </ContentPage.Behaviors>

    <RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
        <ejl:HybridWebView x:Name="hybridWebView" HybridAssetRoot="hybrid_root" RawMessageReceived="OnHybridWebViewRawMessageReceived" />
    </RefreshView>

</ContentPage>

MainPage.xaml.cs

public ICommand RefreshCommand { get; }
private bool isRefreshing;
public MainPage()
{
    InitializeComponent();
    RefreshCommand = new Command(ExecuteRefreshCommand);
    BindingContext = this;
}
private void ExecuteRefreshCommand()
{
    Debug.WriteLine("ExecuteRefreshCommand triggered");
    hybridWebView.Reload();
    Task.Delay(2000).ContinueWith(t =>
    {
        IsRefreshing = false;
        Console.WriteLine("After ExecuteRefreshCommand refreshView: " + refreshView.IsEnabled);
    });
}

There is 'Resource not found (404)' on the screen.
Screenshot_1725615625

I use VueJS Framework to develop the UI, so it's a SPA web page. All the urls are virtual.

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