PDA

View Full Version : Adding a <link rel="video_src" href=""/> to the head


Lleoun
06-03-2009, 04:54 PM
Hi all,

I'm trying to add from a javascript function:
<link rel="video_src" href="http://www.mypage.com"/>
to head of the document...

None of the functions below works.
I don't need to use jquery or to put it inside of a function .. what I need is to add the line to the head..

Please help!
Thanks a ton!




<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script>

$(document).ready(function(){
addLink();
newScript();
});

addLink = function(){
var linka = document.createElement("link");
linka.rel = "video_src";
linka.href = "http://www.mypage.com";
//$("head").append(linka);
document.getElementsByTagName('head')[0].appendChild(linka);
}

function newScript(){
var lk=document.createElement('link');
lk.rel = "video_src";
var text = "http://www.mypage.com";
lk.href = text;
document.getElementsByTagName('head')[0].appendChild(lk);
}


</script>