English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
As WeChat has built-in font scaling function, pages based on WeChat can scale fonts through WeChat. However, in some cases, this is not what we want, because many mobile web page developments use rem as the unit. When using WeChat to scale fonts, it may cause the overall layout of the page to be disordered, which is extremely unfriendly to user experience. We hope to disable the font scaling function of WeChat. Below are some solutions I found by searching for information
1.Android phone prohibits font scaling JS code
<span style="font-size:14px;">/* * Adding this code to the page will make the Android machine page no longer affected by the user's font scaling forced to change size * but there will be a1about a second delay, during which you can consider displaying loading * For reference only */ (function(){ if (typeof(WeixinJSBridge) == "undefined") { document.addEventListener("WeixinJSBridgeReady", function (e) { setTimeout(function(){ WeixinJSBridge.invoke('setFontSizeCallback',{"fontSize":0}, function(res) { // alert(JSON.stringify(res)); }); },0); }); } else { setTimeout(function(){ WeixinJSBridge.invoke('setFontSizeCallback',{"fontSize":0}, function(res) { // alert(JSON.stringify(res)); }); },0); } })(); </span>
2iPhone mobile禁止字体放大,css代码
<span style="font-size:14px;"><style type="text/css"> body { -webkit-text-size-adjust: 100% !important; text-size-adjust: 100% !important; -moz-text-size-adjust: 100% !important; } </style></span>
That's all for this article. I hope the content of this article can bring some help to everyone's learning or work, and I also hope to support the呐喊 tutorial more!
Statement: The content of this article is from the Internet, and the copyright belongs to the original author. The content is contributed and uploaded by Internet users spontaneously. This website does not own the copyright, has not been manually edited, and does not assume relevant legal liability. If you find any content suspected of copyright infringement, please send an email to: notice#oldtoolbag.com (Please replace # with @ when sending an email to report, and provide relevant evidence. Once verified, this site will immediately delete the content suspected of infringement.)