2017-11-18 270 views
0

问题是,在收到SSL证书并将我的网站从http切换到https网站(在我自己的域上)的某些功能在博客平台上停止工作。Blogger从http到https(SSL问题)

我该如何修复代码以使它们再次工作?

<script type="text/javascript"> 
function LoadTheArchive(TotalFeed) 
{ 
    var PostTitles = new Array(); 
    var PostURLs = new Array(); 
    var PostYears = new Array(); 
    var PostMonths = new Array(); 
    var PostDays = new Array(); 

    if("entry" in TotalFeed.feed) 
    { 
     var PostEntries=TotalFeed.feed.entry.length; 
     for(var PostNum=0; PostNum<PostEntries ; PostNum++) 
     { 
      var ThisPost = TotalFeed.feed.entry[PostNum]; 
      PostTitles.push(ThisPost.title.$t); 
      PostYears.push(ThisPost.published.$t.substring(0,4)); 
      PostMonths.push(ThisPost.published.$t.substring(5,7)); 
      PostDays.push(ThisPost.published.$t.substring(8,10)); 
      var ThisPostURL; 
      for(var LinkNum=0; LinkNum < ThisPost.link.length; LinkNum++) 
      { 
       if(ThisPost.link[LinkNum].rel == "alternate") 
       { 
        ThisPostURL = ThisPost.link[LinkNum].href; 
        break 
       } 
      } 
      PostURLs.push(ThisPostURL); 
     } 
    } 
    DisplaytheTOC(PostTitles,PostURLs,PostYears,PostMonths,PostDays); 
} 

function DisplaytheTOC(PostTitles,PostURLs,PostYears,PostMonths,PostDays) 
{ 
    var MonthNames=["January","February","March","April","May","June","July","August","September","October","November","December"]; 
    var NumberOfEntries=PostTitles.length; 
    var currentMonth = ""; 
    var currentYear = ""; 

    for(var EntryNum = 0; EntryNum < NumberOfEntries; EntryNum++) 
    { 
     NameOfMonth = MonthNames[parseInt(PostMonths[EntryNum],10)-1] 

     if (currentMonth != NameOfMonth || currentYear != PostYears[EntryNum]) 
     { 
      currentMonth = NameOfMonth; 
      currentYear = PostYears[EntryNum]; 

      document.write("<div class='dateStyle'><br />" + currentMonth+" "+currentYear+" </div>"); 
     } 

     document.write('<a href ="'+PostURLs[EntryNum]+'"><div class=dayStyle>'+parseInt(PostDays[EntryNum],10)+":&nbsp;&nbsp;</div> "+PostTitles[EntryNum]+"</a><br />"); 
    } 
} 
</script> 

<script src="https://mywebsite.com/feeds/posts/default?max-results=500&amp;alt=json-in-script&amp;callback=LoadTheArchive" /> 
</script> 
<script src="https://mywebsite.com/feeds/posts/default?max-results=150&start-index=151&alt=json-in-script&callback=LoadTheArchive"></script> 
<script src="https://mywebsite.com/feeds/posts/default?max-results=150&start-index=301&alt=json-in-script&callback=LoadTheArchive"></script> 
<script src="https://mywebsite.com/feeds/posts/default?max-results=150&start-index=451&alt=json-in-script&callback=LoadTheArchive"></script> 
<script src="https://mywebsite.com/feeds/posts/default?max-results=150&start-index=601&alt=json-in-script&callback=LoadTheArchive"></script> 
<script src="https://mywebsite.com/feeds/posts/default?max-results=150&start-index=851&alt=json-in-script&callback=LoadTheArchive"></script> 
<script src="https://mywebsite.com/feeds/posts/default?max-results=150&start-index=1001&alt=json-in-script&callback=LoadTheArchive"></script> 

<!--CUSTOMIZATION--> 
<style type="text/css"> 
.dateStyle { 
    color:#000; 
    font-size: 30px; 
    font-family: Fjalla One; 
    margin: 0; 
} 

.dayStyle { 
    color:#000; 
    font-family: Droid Sans; 
    display: inline-block; 
} 

</style> 

而现在的形式说,它看起来像我的帖子主要是代码,我需要添加一些更多的细节,但我不知道该怎么添加更多的,因为所有我需要的东西,我是上面问。

+1

你可以发布您收到的确切的错误?任何文件仍然通过普通的http加载?由于混合了http和https,浏览器可能会拒绝加载某些文件。 – ext

+0

我还没有收到任何错误,因为它'博客平台。我只是看不到这段代码的结果。 –

+0

您也可以在大多数浏览器中检查开发人员工具(F12),检查“控制台”和“网络”是否有任何错误。 – ext

回答

-1

有关更改脚本标记一下以下

<script src="/feeds/posts/default?max-results=500&amp;alt=json-in-script&amp;callback=LoadTheArchive"/> 
<script src="/feeds/posts/default?max-results=150&start-index=151&alt=json-in-script&callback=LoadTheArchive"/> 
<script src="/feeds/posts/default?max-results=150&start-index=301&alt=json-in-script&callback=LoadTheArchive"/> 
<script src="/feeds/posts/default?max-results=150&start-index=451&alt=json-in-script&callback=LoadTheArchive"/> 
<script src="/feeds/posts/default?max-results=150&start-index=601&alt=json-in-script&callback=LoadTheArchive"/> 
<script src="/feeds/posts/default?max-results=150&start-index=851&alt=json-in-script&callback=LoadTheArchive"/> 
<script src="/feeds/posts/default?max-results=150&start-index=1001&alt=json-in-script&callback=LoadTheArchive"/> 
+0

谢谢!它的工作! –

+0

@咖啡豆,以及它的工作原理,它很酷 –

+0

@Coffeebean,它对XML有效。默认情况下,博客编辑器以这种方式关闭任何空标签,当检索数据时,博客xml parser将xml代码转换为有效的html以在浏览器上显示。 – Bassam