You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
I need to add headers & set user-agent in WebView, I used nativescript-webview-utils for this issue before, but if I need to use WebViewExt for handling mailto, how do I add headers or set user-agent when using WebViewExt ?
Thank you.
Nativescript 5.4.0
iOS 11
Angular 7
The text was updated successfully, but these errors were encountered:
We don't support setting custom headers at the moment, and we don't have plans to add it.
We might accept a PR, if implements the feature for all three platforms (android webview, WKWebView and UIWebView).
I've had a look at nativescript-webview-utils and I don't think we'd want to set custom headers that way.
User-agent should be possible, but requires a little code on your part.
Without having tested it:
if(isAndroid){webview.android.getSettings().setUserAgentString(userAgent);}elseif(isIOS){if(webview.isWKWebView){webview.ios.customUserAgent=userAgent;}elseif(webview.isUIWebView){// Note: applies to every webview on the app.NSUserDefaults.standardUserDefaults.registerDefaults(NSDictionary.dictionaryWithObjectForKey(userAgent,"UserAgent"));}}
If you need to capture mailto-links, you should be able to use shouldOverrideUrlLoading-event.
Again without testing:
webview.on(WebViewExt.shouldOverrideUrlLoading,(args)=>{if(url.startsWith('mailto:')){// DO STUFFargs.cancel=true;}});
I need to add headers & set user-agent in WebView, I used nativescript-webview-utils for this issue before, but if I need to use WebViewExt for handling mailto, how do I add headers or set user-agent when using WebViewExt ?
Thank you.
Nativescript 5.4.0
iOS 11
Angular 7
The text was updated successfully, but these errors were encountered: