I have seen a few example posts of this, but I seem to be a little stumped why none of them work.
Here is a stack view of what I am trying to achieve:
<html>
<head>...</head>
<body>
<div>Some stuff, images, text</div>
<div><audio id="audio"><source> src="me.mp3" /></audio></div>
<div>Some stuff, images, text</div>
<div>
<iframe src="file.html">
#document
<html>
<head>...</head>
<body>
<div><button id="stopPlay">Stop Play</button></div>
</body>
</html>
</iframe>
</div>
<div>Some stuff, images, text</div>
</body>
</html>
It has been suggested that to access the audio tag, you would use something like:
window.parent.document.getElementById('audio');
Which gives me an origin error, even though both files are on the same server. So I add, again as suggested document.domain = "[email protected]"
and place this within the iframe, and parent. But still gives me an error that relates to the DOM.
As I am looking to go up the stack, and then search down it to find the element, how would I go about doing this, when other suggests have worked for others ?
The only way I was able to reproduce this error is when using the local file system, It seems you're trying to access your html file from the local file system.
file://c:/wamp/www/foo.htm
- that's the only way I could find to reproduce this, and this is a known bug for chrome. Also makes sense in some regrd, as there is no domain
, thus the origin is null
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments