Is it possible to load a page through UIWebView with POST parameters? I can probably just load an embedded form with the parameters and fill them in with javascript and force a submit, but is there a cleaner and faster way?
Thanks!
Is it possible to load a page through UIWebView with POST parameters? I can probably just load an embedded form with the parameters and fill them in with javascript and force a submit, but is there a cleaner and faster way?
Thanks!
The answer from oxigen worked with a minor change. When using:
It did not work, neither as GET or POST requests, when added a ending slash to the theURL it worked.
Create POST URLRequest and use it to fill webView
Below are examples for POST call for web view with content type x-www-form-urlencoded.
You need to change postData for other content types.
For Swift 3
For Swift 4
This is modify answer of @2ank3th for Swift 3:
for swift 4
first its better to use this extension :
this extension is very useful to handle parameters and its values. second: