如何使用WKWebView取消和增加字体大小? [英] How to de- and increase the font size with WKWebView?
本文介绍了如何使用WKWebView取消和增加字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Safari中,您可以增加和减小字体大小.如何使用WKWebView达到相同的效果?
In Safari you can increase and decrease the font size. How can I achieve the same effect with WKWebView?
推荐答案
Inna建议的代码曾经有效,但从iOS10.3起停止工作.我进行了一些研究,发现我们需要对其稍作更改,只需将"%%"更改为单个%"即可.
The codes suggested by Inna used to work but stopped working from iOS10.3. I did some research and found that we need to make a slight change to it, just changing "%%" to a single "%".
因此JS代码应为:
let js = "document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust='\(fontSize)%'"
我从Apple Developer论坛获得了此信息. https://forums.developer.apple.com/thread/51079
I got this info from Apple Developer forum. https://forums.developer.apple.com/thread/51079
这篇关于如何使用WKWebView取消和增加字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文