EDIT: Why doesn't this work?
@match http://tumblr.com/*
$(document).ready(function() {
$(img).each(function() {
var i = $(this).attr("src");
var n = i.replace("http://", "https://");
$(this).attr("src", function() {
return n;
});
});
});
EDIT: To be clear, I DO NOT OWN THE WEBSITE. I want to have images on sites like https://facebook.com/ and https://tumblr.com/ be on https.
The OP was really close, just need to tweak the selector: $(img)
to $("img")
$(document).ready(function() {
$("img").each(function() {
var link = $(this).attr("src");
var newLink = link.replace("http://example.com", "//example.com");
$(this).attr("src", function() {
return newLink
});
});
});
jQuery requires the use of quotes around DOM element selectors, the OP script would throw img not defined.