WKWebView和Safari之间的区别? [英] Difference between WKWebView and Safari?

查看:1819
本文介绍了WKWebView和Safari之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个特殊的应用程序,我正在使用WKWebView。
但我有一个问题...... WKWebView与Safari(iOS版本的Safari ofc)的行为不同(过时的浏览器)。

I'm creating a special app where I'm using a WKWebView. But I have one problem... WKWebView is acting different (outdated browser) than Safari (iOS version of Safari ofc).

如果我访问adidas。 com / yeezy在Safari上,没有问题。
但是当我在WKWebView中访问这个网站时,它说浏览器不够现代。

If I visit adidas.com/yeezy on Safari, there is no problem. But when I visit this site in WKWebView, it says that the browser is not modern enough.

我真的需要修复这个,否则我的应用程序不能工作。

I really need to fix this otherwise my app can't work.

有没有人有解决方案让WKWebView现代化?

Does anyone has a solution to make WKWebView "modern" ?

谢谢!

推荐答案

我相信这只是配置。查看 WKPreferences

I believe it's just configuration. check out WKPreferences

我想如果你启用任何你能做的,你会找到所要求的功能..我会检查adidas,看看我是否找到了特别需要的东西

I guess that if you enable whatever you can, you'll find the requested feature.. I'll check adidas to see if I find something special needed

编辑:
第二个选项,您可以欺骗网站,使其成为不同的浏览器。
只需设置 customUserAgent ,参见这里

您可以在Mac上看到一个有效的例子。

You can see a working example in your Mac.

1)打开Safari

1) Open Safari

2)开发

3)用户代理

4)其他

复制并将其传递给您的代码,祝您好运!

Copy and past it to your code, Good luck!

以下一个值为例:


Mozilla / 5.0(Macintosh; Intel Mac OS X 10_12_6)AppleWebKit / 604.3.5
(KHTML,与Gecko一样)版本/ 11.0.1 Safari / 604.3.5

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5

这篇关于WKWebView和Safari之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆