Android Firefox插件/扩展,用于添加视口(或其他)标记
我有一个网站的风格(CSS),我可以添加它与时尚。问题是网站没有Android Firefox插件/扩展,用于添加视口(或其他)标记,android,responsive-design,firefox-addon,Android,Responsive Design,Firefox Addon,我有一个网站的风格(CSS),我可以添加它与时尚。问题是网站没有 那么,我怎样才能在一些Firefox for Android插件中添加这个标签呢?来回答我的问题:-)。你可以做到,你需要3件事: 相当于Android的Greasmonkey-您可以使用 添加标记的脚本 @在文档开始时运行脚本的用户脚本指令 实际上,第三部分对Firefox至关重要,因为动态更改viewportmeta标记并不奏效。在加载文档时添加它会产生奇怪的结果(另请参见) 这是一个添加视口的用户脚本示例: // ==Use
那么,我怎样才能在一些Firefox for Android插件中添加这个标签呢?来回答我的问题:-)。你可以做到,你需要3件事:
@在文档开始时运行脚本的用户脚本指令
viewport
meta标记并不奏效。在加载文档时添加它会产生奇怪的结果(另请参见)
这是一个添加视口的用户脚本示例:
// ==UserScript==
// @name Mobile example.com
// @namespace com.something.unique.to.me
// @description Forces the website to behave responsive. Note that you probably need some CSS too.
// @include http://example.com/*
// @include https://example.com/*
// @version 1.0
// @grant none
// @run-at document-start
// ==/UserScript==
function addViewport() {
var metaTag=document.createElement('meta');
metaTag.name = "viewport"
metaTag.content = "width=device-width, initial-scale=1.0"
document.querySelector('head').appendChild(metaTag);
}
addViewport();
注意,USI插件有点难以使用,我停止使用它。您应该改用Tampermonkey,它可以在移动和桌面Firefox上运行。