Hello,
For my app, I need to send a "REFERER" header with the request in a WebView.
It appears I need to use the native functions (loadRequest ? NSURLRequest ? URLRequest ? NSURL ? Url ?), but, unfortunately, i'm totally unable to understand this brainfuck objective C functions, swift, structs, classes and objects, and all this mess.
And then I absolutely don't succeed to pass my referer.
Example of what I tried :
For comparison, example of code I used on B4A !
Thank you for you help...
For my app, I need to send a "REFERER" header with the request in a WebView.
It appears I need to use the native functions (loadRequest ? NSURLRequest ? URLRequest ? NSURL ? Url ?), but, unfortunately, i'm totally unable to understand this brainfuck objective C functions, swift, structs, classes and objects, and all this mess.
And then I absolutely don't succeed to pass my referer.
Example of what I tried :
B4X:
Dim noWebView As NativeObject = WebView
Dim noNSURL As NativeObject
noNSURL.Initialize("NSURL")
noNSURL.RunMethod("initWithString:", Array As Object(Url))
Dim noNSURLRequest As NativeObject
noNSURLRequest.Initialize("NSURLRequest")
noNSURLRequest.RunMethod("initWithURL:", Array(noNSURL))
noNSURLRequest.RunMethod("addValue", Array As Object("REFERER", "xxxxxxxxxxxx"))
noWebView.RunMethod("loadRequest", Array As Object(noNSURLRequest))
For comparison, example of code I used on B4A !
B4X:
'Crée ls Header de référence
Dim extraHeaders As Map
extraHeaders.Initialize
extraHeaders.Put("REFERER", "xxxxxxxxxxxx")
' Récupère l'objet Java
Dim WebViewNative As JavaObject
WebViewNative = WebView
' Charge la page
WebViewNative.RunMethodJO("loadUrl", Array(Url, extraHeaders))
Thank you for you help...