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

[Webview] event unload never called #4669

Closed
julienGrd opened this issue Feb 14, 2022 · 2 comments
Closed

[Webview] event unload never called #4669

julienGrd opened this issue Feb 14, 2022 · 2 comments
Labels
area-controls-webview WebView platform/android 🤖 s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@julienGrd
Copy link

Description

I load one of my website into a webview on the main Page of my .net MAUI App

In this webapp, i use to register event unload in js to properly disconnect my user

But inside the maui app, this event seem never call

If i press back or home button, its not call, but why not, if the behavior is to put the app in background

However, when the app is push back in first plan or reopened, the webview reload, so the previous instance was never relly closed.

actually, this also related to #4169, because without nothing put the app back in first plan make it crash, so i follow #4169 (comment) to make it work

Maybe the resolution of the issue below will have an impact on my problem

Steps to Reproduce

  1. Create a .NET Maui App
  2. put a webview in the main page with targeting a website you can control
  3. on this website implement unload event and for example register something into the local storage to verify if the code go inside
  4. deploy on targeting android physical device
  5. play with app (open it, navigate, go press back, reopen it)
  6. check in the local storage if the unload event was fired, normally its not

Version with bug

Preview 12 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

not any. i try to override the OnDisappearing of my main page to see if y can close my webview with a method but it seem there is nothing available

Relevant log output

No response

@julienGrd julienGrd added the t/bug Something isn't working label Feb 14, 2022
@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Feb 15, 2022
@kristinx0211 kristinx0211 added the s/needs-repro Attach a solution or code which reproduces the issue label Mar 16, 2022
@ghost
Copy link

ghost commented Mar 16, 2022

Hi @julienGrd. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

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.

@julienGrd
Copy link
Author

After some test, i realized the unload seem also never called in chrome android directly, so i think there is nothing you can do.
I think the thing i have to do is detect when the app or the webview is closed and call javascript in the webview

I create the repro project in case you interest anymore. i can put it online and put some instructions if you are interest on this case, otherwise you can close this isssue. I will create an issue specifically to ask how i can handle the app closed and how i can execute some javascript at this moement on the webview.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Mar 16, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 21, 2022
@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 platform/android 🤖 s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants