我想動態地顯示混合應用程序上的圖像。我的意思是圖像位於服務器上,我正在Cordova應用上顯示它們。attr在其他域的圖像不工作在科爾多瓦
我在頭部添加了cordova和jquery。 這是代碼。
var pics = "http://www.test.com/img/53_20160713104002.png";
document["profile-pic"].src = pics;
$("#profile-pic").attr("src", pics);
這裏是html代碼。
<a href="profile.html" data-original-title="" title="">
<img width="35" height="30" id="profile-pic" class="profile img-circle" name="profile-pic" /></a>
請告知我做錯了什麼。
編輯:這似乎是問題是由於跨域。我有白色列出配置文件中的域。
它似乎工作:https://jsfiddle.net/8jwqL6s4/ – Alvaro
它是在瀏覽器中正常工作,而不是在移動應用程序或模擬器。 – Ironic
@CalculatingMachine你可以檢查jQuery是否在移動設備上工作?你使用什麼版本? –