是否在整个页面中替换到https的任何http链接?userscripts.org中有一些脚本,但它们只重定向url,不更改html内容。
谢谢
发布于 2013-05-30 15:19:28
如果您关心的是安全性和隐私,那么安装和使用像到处都是HTTPS.这样的扩展会使更好。
扩展名具有更强的SSL功能:链接、图像、视频和声音文件、CSS和javascript文件、flash对象、AJAX调用等。而Greasemonkey脚本,或者userscript,可能会有相当长的时间来做这方面的工作。
但是,如果您真的只想更改页面中的链接(<a>节点),这并不难。最大的原因是通过AJAX添加链接的站点。因此,使用jQuery和waitForKeyElements()来处理所有链接。
下面是,这是一个完整的脚本,可以让您入门:
// ==UserScript==
// @name _Remap links to https
// @include http://YOUR_SERVER.COM/YOUR_PATH/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
waitForKeyElements ("a", remapToSSL);
function remapToSSL (jNode) {
var node = jNode.get (0);
if (node.protocol === "http:") {
node.protocol = "https:";
}
}https://stackoverflow.com/questions/16831802
复制相似问题