I need to select an html5 video element from inside an embedded ifame (specifically the video element generated from embedding a youtube video). I know that I want to use the $("video") selector to grab the element, but since it is in an iframe It is more complex.
I found that the .contents() method will spill out the iframe contents (this link) However, the request gets blocked because it is a cross-origin request.
here is the DOM error I get after trying the .contents() method:
Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "null" from accessing a cross-origin frame.
at Error (native)
at m.each.contents (file:///home/alex/Desktop/kiosk/Client/jquery.js:2:26679)
at Function.m.extend.map (file:///home/alex/Desktop/kiosk/Client/jquery.js:2:3714)
at m.each.m.fn.(anonymous function) [as contents] (file:///home/alex/Desktop/kiosk/Client/jquery.js:2:26777)
at <anonymous>:2:9
at Object.InjectedScript._evaluateOn (<anonymous>:905:140)
at Object.InjectedScript._evaluateAndWrap (<anonymous>:838:34)
at Object.InjectedScript.evaluate (<anonymous>:694:21)
Any Ideas to fix or work around this?