有没有办法禁用WKWebView for iOS和WebView for android?我正在使用react-native-wkwebview-reborn。
答案 0 :(得分:1)
在此meta中的webview棒中呈现的文档的头部:
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
示例:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
</head>
<body>
</body>
</html>
您可以将此注入您的网页浏览。
const SCRIPT = `
const meta = document.createElement('meta');
meta.setAttribute('content', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0');
meta.setAttribute('name', 'viewport');
document.head.appendChild(meta);
`;
<WebView injectedJavaScript={SCRIPT} />