-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Blazor Hybrid - Allow window.open()
from JavaScript to automatically open a WebView
#20622
Comments
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process. |
@mrlife - Can you clarify exactly what you expect to happen with I tried this: <button id="ThirdPartyAuthButton" onclick="window.open('https://bing.com/')">Authenticate with third party</button> And on Windows it worked fine. On Android interestingly it crashed the app (more details below). But a lot of this can depend on exactly what you want to happen, and exactly which parameters are passed to Details on the Android crash (which is certainly a bug in BlazorWebView): With |
Hi @Eilon, thanks for checking this out! On Windows, did it open in a WebView or the external browser?
An in-app WebView that loads the URL would be best since it won't take the user away from the app.
Here is an example of what the window.open("https://example.com?a=1&b=2", "example-window-name", "height=500,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=500"); |
any news? |
Hi @Eilon, I was wondering if you thought this was something that could be implemented. I really appreciate your time. |
@Eilon I am also looking towards a solution to this. |
Hi, I'm not sure when I'll have more time to investigate, but there's a workaround that I think in general will work fine:
|
Hi @Eilon, thanks for the suggestion. For the purpose behind creating this issue, the workaround does not seem to apply, as the |
@mrlife ah understood, then indeed the workaround won't quite apply there. We'll keep this bug open so that we can investigate a potential fix. |
Hi @Eilon |
@f4n0 hmm I'm not sure. Is it possible to monkey-patch the |
Description
Allow Blazor Hybrid apps to respond to
window.open()
from JavaScript and open in aWebView
.Right now,
window.open()
does not run.Public API Changes
The following button conforms to a third party API's spec for launching an authentication workflow via
window.open()
.BlazorWebView
should open aWebView
just as a browser would open a window.Intended Use-Case
When using a third party JavaScript API, sometimes the API opens a new browser window using
window.open()
to facilitate authentication with the third party.This works well with Blazor but does not work with Blazor Hybrid.
The text was updated successfully, but these errors were encountered: