tampermonkey自定义一个脚本,实现打印浏览器页面的功能
-
下载安装tampermonkey,教程参考此篇
-
新增一个脚本

- 实现代码
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
window.onload = function(){
if(confirm('是否打印本页面?')){
window.print();
}
}
})();
- 保存,接下来在已安装脚本启动就可以了
5.
- 看看效果吧

6032

被折叠的 条评论
为什么被折叠?



