Help - Search - Members - Calendar
Full Version: Dynamic YouTube popup window error "an error occurred, please try again later."
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Heliotrack
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>
Christian J
The quote characters here look incorrect:

CODE
src=\""+theLink+"\
Heliotrack
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();\" />";
Heliotrack
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!!
Christian J
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!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.