ios - 如何在 WKWebView 中使用动态查询字符串打开 url
问题描述
我的网站上有一个按钮,它有 href https://live.example.net/?dynamic_encypted_query-string,所以我想在我的 ios 应用程序的 webview 中打开这个 url。目前我正在通过电容器框架构建一个 Web 应用程序,在该框架中我将代码写入我的 WebViewController.swift 文件
class WebViewController: UIViewController, WKUIDelegate {
var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "https://live.example.net/?*")
let myRequest = URLRequest(url: url!)
webView.load(myRequest)
// Do any additional setup after loading the view.
}
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
}
这会在 Web 视图中打开域(https://live.example.net),但我想用查询字符串数据打开它。
let url = URL(string: "https://live.example.net/?*")
我认为这也不适用于获取查询字符串数据。
解决方案
推荐阅读
- mysql - 如何从多个表中计算不同的 id?
- android - 我请求大量访问令牌而不重用 API 可以吗?
- python - Django 与 Peewee 连接池 MySQL 断开连接
- java - 从java中的哈希映射返回第n个值和键
- javascript - 发送数据后刷新 ng-model
- c++ - 如何在 C++ 中的 QMessageBox 中设置文本颜色
- python - Keras 中用于加权错误分类样本的自定义损失函数
- sql-server - 在 .NET Core 2.1 中将 IIS 基本身份验证传递给 SQL Server
- jquery - 自定义具有 4 个不同范围的 jQuery UI 滑块
- python - pymssql 无法连接到 SQL Server 数据库