You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Viewport argument key "viewport-fit" not recognized and ignored.
google 了一下发现是因为适配 iPhoneX 的刘海屏而导致的,这样的话,就需要对 iOS 11 做兼容性处理了。
解决:
(function(){varviewportTag=null;varmetaTags=document.getElementsByTagName('meta');for(vari=0;i<metaTags.length;i++){if(metaTags[i].getAttribute('name')==="viewport"){viewportTag=metaTags[i];break;}}if(!viewportTag){viewportTag=document.createElement("meta");viewportTag.setAttribute('name','viewport');}varviewportTagContent='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0';// Detect if iOS deviceif(/(iPhone|iPod|iPad)/i.test(window.navigator.userAgent)){// Get iOS major versionvariosVersion=parseInt((window.navigator.userAgent).match(/OS(\d+)_(\d+)_?(\d+)?likeMacOSX/i)[1]);// Detect if device is running >iOS 11// iOS 11's UIWebView and WKWebView changes the viewport behaviour to render viewport without the status bar. Need to override with "viewport-fit: cover" to include the status bar.if(iosVersion>=11){viewportTagContent+=', viewport-fit=cover';}}// Update viewport tag attributeviewportTag.setAttribute('content',viewportTagContent);})()
问题:
在 iOS 10 上报错:
Viewport argument key "viewport-fit" not recognized and ignored.
google 了一下发现是因为适配 iPhoneX 的刘海屏而导致的,这样的话,就需要对 iOS 11 做兼容性处理了。
解决:
参考引用:mapsplugin/cordova-plugin-googlemaps#1645
The text was updated successfully, but these errors were encountered: