Hey i get my html content via json. The image blocks look like:
src=\"/2017/03/test.jpg\" alt=\"test\" width=\"576\" height=\"800\" srcset=\"/2017/03/test.jpg 576w, /2017/03/test-112x155.jpg 112w, /2017/03/test-432x600.jpg 432w\"
The src should look like mywebsite/img-src but it looks like localhost/img-src right now...
I tried to replace it via JavaScript but then it looks like: localhost/mywebsite/img-src
Does somebody have an idea
Edit: the image is hosted on ONE Website! And it should be shown on every device. Now its 404...
Hey i get my html content via json. The image blocks look like:
src=\"/2017/03/test.jpg\" alt=\"test\" width=\"576\" height=\"800\" srcset=\"/2017/03/test.jpg 576w, /2017/03/test-112x155.jpg 112w, /2017/03/test-432x600.jpg 432w\"
The src should look like mywebsite./img-src but it looks like localhost/img-src right now...
I tried to replace it via JavaScript but then it looks like: localhost/mywebsite./img-src
Does somebody have an idea
Edit: the image is hosted on ONE Website! And it should be shown on every device. Now its 404...
Share Improve this question edited Mar 7, 2017 at 15:36 lostluke asked Mar 7, 2017 at 15:24 lostlukelostluke 1651 gold badge4 silver badges13 bronze badges 3- I'm unclear about what the problem is. May you edit your question to be clearer? – evolutionxbox Commented Mar 7, 2017 at 15:28
- Either append the URL before it populates the source of your image, or use JS to find all the images and change their source to include it. – Waxi Commented Mar 7, 2017 at 15:29
-
1
I would suggest do not touch
src
. If server returns response like this then it is meant to look like this. Instead, if you're working onlocalhost
create virtual host, for exampledev.mysite.
configure Apache to point it to subfolder, for example/var/www/html/mysite/img-src
– lomboboo Commented Mar 7, 2017 at 15:32
1 Answer
Reset to default 5It can be done by including a <base>
tag in the <head>
tag like this:
<base href="mywebsite./path">
For more information reference this webpage: https://www.w3schools./tags/tag_base.asp