我想用jQuery替換所有HTTP到頁面的HTTPS。Repalce所有HTTP到HTTPS的頁面
我想這一點:
jQuery('a').each(function() {
var href = jQuery(this).attr('href');
if (href.indexOf('http:') > -1) {
href = href.replace('http:', 'https:');
jQuery(this).attr('href', href);
}
});
我想替換HTTP:爲https:在頁面加載 指導我如何做到這一點?
我沒有看到任何錯誤。你是什麼意思不起作用?控制檯錯誤? – laaposto 2014-09-23 13:03:03
你把代碼放在'$(document).ready()'函數中嗎? – Jerodev 2014-09-23 13:03:35
它不會將http替換爲https – 2014-09-23 13:09:08