-
Notifications
You must be signed in to change notification settings - Fork 49
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
Expose platform webview for initialization to enable customization #45
Comments
That would be great as I have had to modify a local copy of your codebase to add this tweaks between MODIFICATION BEGIN END comments:
Thank you for your effort, Eilon |
Forget about my last post. It is working now. The problem was that a colleague did not provide me the full information: the origin URI should have been localhost:3000 instead of localhost. That is what, I guess, is allowed to avoid CORS error. But as you can see, AppHostAddress could be another member that I would like to set from outside at the beginning. |
This feature is merged for 1.0.0-preview6. Customizing web view initializationTo customize the platform web view you can add an event handler for the new myHybridWebView.HybridWebViewInitialized += MyHybridWebView_WebViewInitialized;
...
private void MyHybridWebView_WebViewInitialized(object sender, HybridWebViewInitializedEventArgs e)
{
// Use e.WebView to customize things
} And in that event handler you can access the platform-specific properties and methods of the web view control. This code would typically be in an For example, this event handler customizes the zoom settings on Windows and Android, and does nothing for iOS and macOS: private void MyHybridWebView_WebViewInitialized(object sender, HybridWebViewInitializedEventArgs e)
{
#if WINDOWS
// Disable the user manually zooming
e.WebView.CoreWebView2.Settings.IsZoomControlEnabled = false;
#elif ANDROID
// Customize zoom options
e.WebView.Settings.TextZoom = 200;
e.WebView.Settings.SetSupportZoom(false);
#endif
} |
For example, in #27 (comment) this was mentioned:
The text was updated successfully, but these errors were encountered: