Inter html doc communication


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
I have two html docs on the same page and can’t access elements in one from the other. I have a problem where a video the user is watch will continue to play if they click and activate an external line. How do I stop the video playing in an iframe from another html doc? I’m using a Wix environment. The code example just shows two html docs with one trying to access an element in the other. The code as is will not work.

```

Is it possible with Wix for HTML doc number two to access elements in HTML doc number one?
If I can do this then I know how to stop the video that is playing before I activate an
external link to another web site.

HTML doc number one


<!DOCTYPE html>
<html>
<body>

<p id="demo">Click the button to change the text in this paragraph.</p>
<script>
window.name = "MyWindow";
</script>

</body>
</html>

HTML doc number two********

<!DOCTYPE html>
<html>
<body>


<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    var x window.document
    x.document.getElementById("demo").innerHTML = "Hello World";
}
</script>

</body>
</html>

#2

You can try JQuery’s get method, or try a Raw HXR Request.

This question was similarly addressed on this stackoverflow post, though not specific to wix.

Before reaching out to us, try the Wix Help Centre.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.