1

How can I get the value of flashvars attribute?

<div>
<embed  height="360" 
    src="//www.youtube.com/get_player?enablejsapi=1" 
    type="application/x-shockwave-flash" 
    width="100%" 
    allowfullscreen="true" 
    allowscriptaccess="always" 
    bgcolor="#fff" 
    scale="noScale" 
    wmode="opaque" 
    flashvars="fmt_list=34%2F640x336%2F9%2F0%2F115%2C5%2F426x224%2F7%2F0%2F0&amp;fmt_stream_map=34%7Chttp%3A%2F%2Fredirector.googlevideo.com%2Fvideoplayback%3Fid%3Da067d9378dddd818%26itag%3D34%26source%3Dpicasa%26cmo%....">
</embed>
</div>

I am using getElementsByTagName to get the element

var codedLink = content.document.getElementsByTagName('embed');

but when I try codedLink.flashvars I get undefined.

2 Answers 2

2

getElementsByTagName(), returns an array of dom element references, so you need to access the element by using array index first

you need to use

codedLink[0].getAttribute('flashvars')
Sign up to request clarification or add additional context in comments.

3 Comments

I already tried it but unfortunately i got the same output 'undefinded', I read somewhere that i should use XPCNativeWrapper.unwrap(codedLink) but i get HTMLEmbedElement
@user2463937 can you try codedLink[0].getAttribute('flashvars')
it did work :D thanks a looooot ^^ and really thanks a lot for your quick answers
0

you can use .attr("/* attribute name */")

$(document).ready( function() {
      console.log($('embed').attr('flashvars'));

});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.