gpt4 book ai didi

ios - Swift:在特定浏览器选项卡中打开 URL?

转载 作者:搜寻专家 更新时间:2023-10-31 08:15:13 25 4
gpt4 key购买 nike

使用 JavaScript,您可以在特定的浏览器选项卡中打开 URL。

如何在 iOS 应用程序中使用 Swift 完成同样的事情,即在特定选项卡中的 Safari/Chrome 中打开 URL。

UIApplication open function没有列出有关 options 参数的信息,这似乎可以让您指定一个命名选项卡以在其中打开 URL。

最佳答案

这是我在 Google Chrome 中打开链接的方式:

var newLink: String = "http://www.apple.com"
newLink = link.replacingOccurrences(of: "http://", with: "googlechrome://")
if UIApplication.sharedApplication().canOpenURL(NSURL(string: newLink)!) {
UIApplication.sharedApplication().openURL(NSURL(string: newLink)!)
} else {
let alertController = UIAlertController(title: "Sorry", message: "Google Chrome app is not installed", preferredStyle: .Alert)
let okAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(okAction)
self.presentViewController(alertController, animated: true, completion: nil)
}

Opera Mini:

opera://open-url?url=http://

Opera Touch:

touch-https://

火狐:

firefox://open-url?url=http://

海豚:

dolphin://

勇敢:

brave://open-url?url=http://

关于ios - Swift:在特定浏览器选项卡中打开 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39949169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com