I get data from the server to dynamically create a video gallery on the client. Those data contain metadata-related information such as contributor etc.
I have a standard snippet for dublin core data in my webpage like
<meta name="DC.Source" id="videdsource" />
<meta name="DC.Description" id="metadesv" />
<meta name="DC.Creator" id="videdcreator" />
<meta name="DC.Contributor" id="videdcontr" />
//and so on, for all the dublin core elements...
Each time the users picks another video,I want to dynamically change the metadata values using a code like
document.getElementById("videdcreator").content=arrayvid[i];
This is not working. Because If I load the web page and look at the source code, the dublin core elements that are standard have a value , like
<meta name="DC.Rights" content="Copyright 2014" />
but, the elements that I want to change dynamically, have no values, like
<meta name="DC.Contributor" id="videdcontr" />
How do I fix this?
What is the best practice to dynamically handle multimedia metadata on a webpage?
Thanks
I'm fairly new to JS and to stackoverflow as well. Don't know if this is going to help you, but have you tried the following?
Ex. 1
Have id's to your meta tags -- checked
JS function
function changeTags(){ $("#videdsource").attr("content","yourlink"); $("#metadesv").attr("content","Coolest video"); $("#videdcreator").attr("content","Chuck Norris"); }Does this help you in any way?