Find
Because before routing always wanted to tryThird-party social comment boxWP to replace their comments,But nonetheless could not find any suitable selection,Now once again we had to exchange for carrying the comment box。(Well, anyway, no one will come to comments。)
But after the exchange's own comment box I found a problem,That is when the matter turned Ajax publish what comments,Will lead{“error”:”get from image source failed: E405″}Error and thus can not comment。
Reason
After the conclusion by google,according toHereThe records show that seven cattle CDN problems。of course,Facts have proved that the problem is indeed CDN,But it may not be only seven cattle would lead to such a right,Or we can guess,CDN is leading to the problem。
The principle isCDNPut yourcomments-ajax.jsGo to the file cache,The results lead to the wrong path,This time we have two options to fix this problem。
- Js file can modify it to support your CDN path
- This document will be excluded from the mirror list separately the CDN
Solution
1、Modify comments-ajax.js file
The advantage of this method is that you can still experience the full image of CDN services,You need to open your theme directory under the corresponding file and then modify it,Find the following code fragment (generally should be in the beginning)
1 2 3 4 5 |
var i = 0, got = -1, len = document.getElementsByTagName('script').length; while ( i <= len && got == -1){ var js_url = document.getElementsByTagName('script')[i].src, got = js_url.indexOf('comments-ajax.js'); i++ ; } |
Then in the code behind the phrase is added
1 |
js_url = js_url.replace('logcg.qiniudn.com','www.logcg.com'); |
Such,After editing should look like below
1 2 3 4 5 6 |
var i = 0, got = -1, len = document.getElementsByTagName('script').length; while ( i <= len && got == -1){ var js_url = document.getElementsByTagName('script')[i].src, got = js_url.indexOf('comments-ajax.js'); i++ ; } js_url = js_url.replace('logcg.qiniudn.com','www.logcg.com'); |
Then save enough uploaded,of course,I hope you can get seven cows file updates XD。
2、Adding CDN Mirror exception
If you're like me, useWP Super CacheTo enable CDN mirror,Then you can also choose a way I kind of repair - the js file directly excluded from the list of mirrors like a,Although more time to load a js file,But eliminating the need to deal with seven cattle that slow refresh process,But it is still very good,Immediate ah ~
Other,I think the rest of CDN plugin should also have a similarExclusions,Then you can understand the spirit of their own to plug in the room - as for direct use code CDN great God ......Please go left ╮(╯▽╰)╭
All right,find youWP Super CacheofCDN page,Then, find out below“If it is preceded by the exclusion "This one,willcomment-ajaxFill into the like。
[warning]
Remember to use a comma between multiple statements separated English Oh!
[/warning]
As shown in FIG like the completed:
Such,This is only one file to be excludedCDNOutside the。
The same time,You can page themInspect ElementTo verify,For example, this:
When are you going to test this comment,It has been found that it can be used normally。
But at the same time the route was submitted seven cattle cache update,By the finish of this article,Seven cattle side of the document is still not updated ╮(╯▽╰)╭
In short,Such an approach is effective if the replacement tile ~ SaveCDN,Do not goManually modify js addressGot it。
Original article written by LogStudio:R0uter's Blog » Use seven cattle CDN cause ajax error Comments{“error”:”get from image source failed: E405″}
Reproduced Please keep the source and description link:https://www.logcg.com/archives/579.html
Ok,According to the online code changing for the better,But found or not,See "Plug-in and then go look for yourself," he suddenly thought,It is not a plug-in problem,Disable the static widget,Try,Really good,thank!
ヽ(^。^)丿
Collection,A great need for this
Like help:)
Thumbs up,Like with bloggers。Now in exchange for the comment box default Wordpress
:) Claw grip。
You write this in great detail。
Miuzan ^ _ ^
Very good idea,Anyway, my comment is I play bad,With security treasure cdn,Later on the wrong embarrassing dead ~ ~
I was also engaged in a variety of,Later, a look back found:Ugh? WP Super Cache have this feature Well .................................... XD。I was soaked with sweat。
You see 🙂,Already commented on it ╮(╯▽╰)╭