Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/393.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用<;img>;安卓上有本地图像吗?_Javascript_Android_Image - Fatal编程技术网

Javascript 如何使用<;img>;安卓上有本地图像吗?

Javascript 如何使用<;img>;安卓上有本地图像吗?,javascript,android,image,Javascript,Android,Image,使用,本地文件在PC上可以正常工作,但在安卓7上无法显示;而是显示一个无照片图标。我怎样才能解决这个问题 <img src="photo.png"> (photo.png与.html文件放在同一文件夹中。)您必须声明照片的路径: <img sc = " xxxpathxxx/"photo.png"> 您必须声明照片的路径: <img sc = " xxxpathxxx/"photo.png

使用
,本地文件在PC上可以正常工作,但在安卓7上无法显示;而是显示一个无照片图标。我怎样才能解决这个问题

<img src="photo.png">


photo.png
.html
文件放在同一文件夹中。)

您必须声明照片的路径:

<img sc = " xxxpathxxx/"photo.png">

您必须声明照片的路径:

<img sc = " xxxpathxxx/"photo.png">
这是本地文件的问题。文件路径与PC的Google Chrome路径不同,在Google Chrome路径中,您可以将HTML文件拖到浏览器中,并将其加载到特定路径中,并且由于photo.png无法指向任何地方

相反,您需要使用访问本地文件。无论photo.png是本地资源还是Internet资源,您都需要使用photo.png的绝对路径,例如:

http://localhost/path/to/photo.png
http://www.mywebsite.com/path/to/photo.png
file://data/local/tmp/photo.png
这方面的问题在于本地文件。文件路径与PC的Google Chrome路径不同,在Google Chrome路径中,您可以将HTML文件拖到浏览器中,并将其加载到特定路径中,并且由于photo.png无法指向任何地方

相反,您需要使用访问本地文件。无论photo.png是本地资源还是Internet资源,您都需要使用photo.png的绝对路径,例如:

http://localhost/path/to/photo.png
http://www.mywebsite.com/path/to/photo.png
file://data/local/tmp/photo.png
看这里:看这里: