国产欧美日韩第一页|日本一二三不卡视频|在线精品小视频,亚洲第一免费播放区,metcn人体亚洲一区,亚洲精品午夜视频

添加ssl證書后https訪問無js,css處理辦法

2020-10-12 10:26:36 2114

代碼中引用所致

主頁面用https,相關(guān)的資源也要用https的,否則瀏覽器會(huì)拒絕加載這些資源

請將css和js都用https

在https的網(wǎng)站中引用http路徑的js或css會(huì)導(dǎo)致不起作用,其形如:

 

<script src="http://www.tjdsmy.cn/jquery-1.11.0.min.js"></script>1

 

解決辦法:

 

將http:去掉,改為

 

<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>

 

 

 

常見模板例子:

wordpress

找到functions.php

 

添加如下代碼:

add_filter('script_loader_src', 'agnostic_script_loader_src', 20,2); function agnostic_script_loader_src($src, $handle) {return preg_replace('/^(http|https):/', '', $src); } add_filter('style_loader_src', 'agnostic_style_loader_src', 20,2); function agnostic_style_loader_src($src, $handle) {return preg_replace('/^(http|https):/', '', $src); }

 

 

 

 

 


提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: