I have some HTML code and there somewhere I want to display a video with Javascript. I have a function that gives me a valid link to the video player and source. So if I post it directly without function in src
it works fine.
So my question is how can I use my function in the src
tag?
<script type="text/javascript" src="get_link()"</script>
A solution without jQuery/document.* is wanted if possible. I know I could do something like that document.getElementById("iframeid").setAttribute("src","link")
.
Edit
All of the solutions were not working in my case. But anyways it's not a solution for me to do it in Javascript because of security issues. And there is no way to use nodejs. So thanks for your comments anyway. =)