Manipulate Audio from One HTML Page with Javascript on Another | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Manipulate Audio from One HTML Page with Javascript on Another

In a local test project, I'm using Bluefish to manipulate a self-made website, and using Firefox to see how it looks and debug using the browser's built-in developer console. It's basically a web page with another web page inside of it (thus, it uses an IFrame). The parent web page has an audio player which randomly selects a song and plays it, then picks another (this is done with a pretty nice Javascript code, which also displays the song title, artist, and album title). I want to be able to pause the music when media starts playing on the child web page (the HTML inside the IFrame), but I'm running into issues with cross-site security. Even though the HTML pages are in the same folder, it states that they are two different "sites". I've tried an external Javascript document, trying to allow cross-site with a META tag, and other tips from the internet, but to no avail; the music player plays on top of content regardless, or the whole thing breaks. How do I fix this?

15th Aug 2020, 1:39 AM
Harvey Houston
Harvey Houston - avatar
7 Answers
15th Aug 2020, 1:46 AM
BroFar
BroFar - avatar
+ 2
Yes
15th Aug 2020, 1:51 AM
BroFar
BroFar - avatar
+ 2
Harvey Houston you can use innerText as well...
15th Aug 2020, 1:54 AM
BroFar
BroFar - avatar
+ 1
Thanks, I'll try that when I get back to my laptop.
15th Aug 2020, 1:57 AM
Harvey Houston
Harvey Houston - avatar
0
I can share a sample of the code I am using, if that will help anyone. I'll have to do it through my laptop, though, as I don't think I can easily send an example through the Sololearn app.
15th Aug 2020, 1:41 AM
Harvey Houston
Harvey Houston - avatar
0
So, I call the "innerHTML" from the parent page? Is that how it is done?
15th Aug 2020, 1:51 AM
Harvey Houston
Harvey Houston - avatar
0
Didn't work. Here's an example of the code I'm working on: https://code.sololearn.com/WSgK0wvoZ71K/
15th Aug 2020, 4:08 AM
Harvey Houston
Harvey Houston - avatar