Why src attruibute wont render files at localhost

2019-09-20 07:38发布

问题:

I have a working program where images and files are loaded using src="http://localhost/some-path". When I visit application from phone, it cant load/find any of the files. The application renders perfectly on every desktop I have tried. Why is it that my iPhone doesn't like the localhost in the url?

<link rel="stylesheet" href="http://localhost/Ziroid_Functions/Clovis_App/public/clovisapp.css"> 

<div class="left"><img src="http://localhost/Ziroid_Functions/Clovis_App/public/img/doubleUp.png" alt="Smiley face" ></div>

<script type="text/javascript" src="http://localhost/Ziroid_Functions/Clovis_App/public/jsmpeg.min.js"></script>

Is it because phones are not capable of understanding localhost path? Does Apache2 have to be installed to interrupt localhost? Or is localhost a Desktop/laptop thing only?

回答1:

Localhost does not work (normally) from phones, because they have no web server installed. In order to view web content, a web server is required.



标签: localhost