Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Dynamic YouTube popup window error "an error occurred, please try again later."

Posted by: Heliotrack Jun 6 2018, 02:49 PM

Hello,
I am trying to create a dynamically loaded popup window with embedded youtube content. The code works fine except I get only a black youtube window with a red play button. When the play button is clicked the player displays "An error occurred. Please try again later."

This is happening Edge, Firefox, and Safari.

Can anyone tell me why this is not working?

here is the code...


<!DOCTYPE html>
<html>
<head>
<title>test</title>

<style>
#youTube_pop {z-index: 1;
position: absolute;
top: 60px;
left: 10px;
background: rgba(255,255,255,1);
display: none;
text-align: center;
border-top-left-radius: 6px 6px;
border-bottom-left-radius: 6px 6px;
border-top-right-radius: 6px 6px;
border-bottom-right-radius: 6px 6px;
border-color:black;
border-width: 3px;
border-style:solid;
}
</style>

<script type="text/javascript">
function onYouTubeClick(theLink,caption) {
document.getElementById("youTube_pop").style.display="block";
document.getElementById("youTube_pop").innerHTML = ""+caption+"<br><iframe width=\"854\" height=\"480\" src=\""+theLink+"\ frameborder=\"0\" ></iframe><br><input id=\"clickMe\" type=\"button\" value=\"Close\" onclick=\"closeYouTube();\" />";
}
function closeYouTube() {
document.getElementById("youTube_pop").style.display="none";
}
</script>

</head>

<body>
<a onclick="onYouTubeClick('https://www.youtube.com/embed/adX6ULWKHng','Caption')" href="java script:void(0);">YouTube popup window test</a><br>
<div id="youTube_pop"></div>
</body>
</html>

Posted by: Christian J Jun 6 2018, 03:29 PM

The quote characters here look incorrect:

CODE
src=\""+theLink+"\

Posted by: Heliotrack Jun 6 2018, 05:21 PM

Ah yes, exactly. Sometimes it just takes another set of eyes. I was missing a quote.
This works...

src=\""+theLink+"\"

full line

document.getElementById("youTube_pop").innerHTML = ""+caption+"<br><iframe width=\"854\" height=\"480\" src=\""+theLink+"\" frameborder=\"0\" ></iframe><br><input id=\"clickMe\" type=\"button\" value=\"Close\" onclick=\"closeYouTube();\" />";

Posted by: Heliotrack Jun 6 2018, 06:41 PM

And a silly question... How do you do the code block. I know it is bad form to just paste code in the body of the message.

BTW, thanks a zillion for your help!!

Posted by: Christian J Jun 6 2018, 07:10 PM

QUOTE(Heliotrack @ Jun 7 2018, 01:41 AM) *

And a silly question... How do you do the code block. I know it is bad form to just paste code in the body of the message.

In the Fast Reply box (bottom of page) you'd have to type the BB Code manually, but if you click e.g. the More Options, Reply or Add Reply buttons you get a text box with code formatting buttons above, and also a link to BB Code Help below the smilies.

QUOTE
BTW, thanks a zillion for your help!!

You're welcome!

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)