我正在使用cordova 构建一个应用程序,我的html 中有一个带有标签的SVG 元素。图片的 url 来自我的 firebase 存储,该 url 工作正常。如果我直接将网址放在我的 html 中:
<image xlink:href="url"/>
它工作正常并显示图像。(在android上测试,调试)。
但我需要做的是通过 javascript 设置 xlink:href 槽,所以我正在做:
document.getElementById("imageID").setAttributeNS('http://www.w3.org/1999/xlink', 'href', "the url");
我也试过:
document.getElementById("imageID").setAttribute('xlink:href', 'the url');
但是这两种尝试都会引发此错误:
加载资源失败:net::ERR_FILE_NOT_FOUND [file:///android_asset/www/undefined]
并显示标准网址未找到图片
我无法为我的生活弄清楚为什么,图像网址工作正常。