The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Dynamic YouTube popup window error "an error occurred, please try again later."
Heliotrack
post Jun 6 2018, 02:49 PM
Post #1





Group: Members
Posts: 3
Joined: 6-June 18
Member No.: 26,655



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>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 6 2018, 03:29 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



The quote characters here look incorrect:

CODE
src=\""+theLink+"\
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Heliotrack
post Jun 6 2018, 05:21 PM
Post #3





Group: Members
Posts: 3
Joined: 6-June 18
Member No.: 26,655



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();\" />";
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Heliotrack
post Jun 6 2018, 06:41 PM
Post #4





Group: Members
Posts: 3
Joined: 6-June 18
Member No.: 26,655



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!!

This post has been edited by Heliotrack: Jun 6 2018, 06:45 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 6 2018, 07:10 PM
Post #5


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



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!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 12:08 PM