简体   繁体   English

SFSafariViewController 可以加载 POST 请求吗?

[英]Can SFSafariViewController load a POST request?

I would like to load a POST request using SFSafariViewController, just like webView.loadRequest(request) .我想使用 SFSafariViewController 加载 POST 请求,就像 webView.loadRequest webView.loadRequest(request) But I find init(url:entersReaderIfAvailable:) accepts NSURL only.但我发现init(url:entersReaderIfAvailable:)只接受 NSURL。 Is it possible to do POST?可以做POST吗?

No, you can't.不,你不能。 It's a browser not a webview.它是浏览器而不是网络视图。

It's possible that you can do the request in advance, but I guess you're doing it to get cookies or something like that..您可能可以提前完成请求,但我猜您这样做是为了获取 cookie 或类似的东西..

So, untested, but you could create a local web page that you load with some parameters, it executes the POST using JavaScript and after its complete it redirects (if required) to some other URL.因此,未经测试,但您可以创建一个带有一些参数的本地网页,它使用 JavaScript 执行 POST,并在完成后重定向(如果需要)到其他一些 URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 强制SFSafariViewController加载网站的桌面版本 - Force SFSafariViewController to load the desktop version of a website 有没有办法在SFSafariViewController的初始请求中设置引用? - Is there a way to set the referer in the initial request made by SFSafariViewController? XCode 7-Swift-通过SFSafariViewController自动加载站点 - XCode 7 - Swift - Automatically load site via SFSafariViewController 如何将SFSafariViewController设置为UISplitViewController的Detail Controller? - How can SFSafariViewController be setup as the Detail Controller for UISplitViewController? 我可以在 SFSafariViewController 中从 Safari 获得 cookies 吗? - Can I get cookies from Safari in a SFSafariViewController? iOS SFSafariViewController加载没有NavigationBar或toolBar的空白页面 - iOS SFSafariViewController load a blank page without navigationBar or toolBar 无法发布服务请求 - Can't POST a request to service 如何在已加载的SFSafariViewController顶部正确放置UIButton? - How can I properly place a UIButton on top of a loaded SFSafariViewController? 我什么时候可以使用带有通用链接的SFSafariViewController,WKWebView或UIWebView? - When can I use a SFSafariViewController, WKWebView, or UIWebView with universal links? 如何将同步发布请求转换为异步发布请求? - How can I convert a synchronous post request to an asynchronous post request?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM