Skip replacing meta/viewport

pull/215/head
M66B 5 months ago
parent f0932039cc
commit 6c460eef23

@ -2479,15 +2479,17 @@ public class HtmlHelper {
// https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag
// https://drafts.csswg.org/css-device-adapt/#viewport-meta
Elements meta = document.select("meta").select("[name=viewport]");
if (meta.size() != 1)
return;
// Note that the browser will recognize meta elements in the body too
if (overview) {
// fit width
meta.remove();
document.head().prependElement("meta")
.attr("name", "viewport")
.attr("content", "width=device-width");
//meta.remove();
//document.head().prependElement("meta")
// .attr("name", "viewport")
// .attr("content", "width=device-width");
} else {
if (meta.size() == 1) {
String content = meta.attr("content");
String[] param = content.split("[;,]");
for (int i = 0; i < param.length; i++) {
@ -2510,12 +2512,6 @@ public class HtmlHelper {
}
}
meta.attr("content", TextUtils.join(",", param));
} else {
meta.remove();
document.head().prependElement("meta")
.attr("name", "viewport")
.attr("content", "width=device-width, initial-scale=1.0");
}
}
if (BuildConfig.DEBUG)

Loading…
Cancel
Save