Issue
How can I read url from a txt file and use in html? I have a video source url in .txt file. How can I use this url in the html file? Sometimes I want to edit the video source in the .txt file.
In the /videosrc.txt:
http://www.videoexaple.com/videos/video.mp4
In /index.html file:
<html>
<head>
<title></title>
</head>
<body>
<video id="video">
<source id="videosource" src=" -url from /video.txt- " type='video/mp4'>
</video>
</body>
</html>
Solution
try this
fetch('file.txt')
.then(response => response.text())
.then(text => { document.getElementById("videosource ").src =text;})
Answered By - Mohammad Ali Rony
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.