我們仍然有這個問題。我們認爲這是一個源自Appengine Wordpress插件的問題。
我們想出了以下解決方法來獲取圖像正確加載:
創建谷歌瀏覽器一個書籤,並添加以下網址:
javascript:var start = var targetUrls = ["//" + window.location.host + "/wp-content/uploads/","//" + window.location.host + "/_ah/gcs/bucket-name/"];var htmlAttributes = ["src", "srcset"];jQuery("img").each(function(index, img) {targetUrls.forEach(function(pattern) {htmlAttributes.forEach(function(htmlAttr) {var htmlObj = jQuery(img).attr(htmlAttr);if (htmlObj) {jQuery(img).attr(htmlAttr, htmlObj.replace(new RegExp(pattern, "g"), "//bucket-name.storage.googleapis.com/"));}});});});
全碼:
var targetUrls = [
"//" + window.location.host + "/wp-content/uploads/",
"//" + window.location.host + "/_ah/gcs/bucket-name/"
];
var htmlAttributes = ["src", "srcset"];
jQuery("img").each(function(index, img) {
targetUrls.forEach(function(pattern) {
htmlAttributes.forEach(function(htmlAttr) {
var htmlObj = jQuery(img).attr(htmlAttr);
if (htmlObj) {
jQuery(img).attr(htmlAttr, htmlObj.replace(new RegExp(pattern, "g"), "//bucket-name.storage.googleapis.com/"));
}
});
});
});
根據這篇文章:http://stackoverflow.com/a/29664200/2302437它應該像上面提到的那樣工作...... Google上似乎也沒有這樣的文檔:/ –
該請求返回200 ,所以它似乎工作。你是否記錄了迴應內容,看看它是什麼? – GAEfan