The problem.
You'd expect the "embed code" tool to allow you to add a simple javascript pop up code to a public site page so you can have a video or other content pop up on demand. But it doesn't and should really be renamed the "embed some code" tool. Anything other than the simplest html gets filtered out so javascripts won't execute.
The obvious answer is to wrap the javascript in </form> code here <form> tags which disables the filters that strip code. This effectively "closes" the opening page form tag and defeats whatever MSFT has added to eliminate certain code tags – but it only works in competent browsers like Firefox. Unfortunately people still use IE and if you do use that method, you'll find that IE drops the last <form> tag which breaks the whole page.
Because I like finding ways to do things MSFT says I can't, I fiddled with this and found an (admittedly) clumsy workaround. Basically you put the video embed code in one file, call that file with the javascript code in another file and then iframe that file on your page…..like this:
- Paste your video embed code in notepad, save as an aspx file and upload to the site assets library (or create the file directly in Sharepoint Designer).
- Paste the javascript pop up code calling the first aspx file in notepad and upload that aspx file to site assets.
- Insert an embed code snippet on your public page iframing the 2nd aspx file
When the link is clicked, the javascript executes and opens up the first file containing the video in a pop up. The script is enclosed in an iframe so is unaffected by the MSFT page filters that would normally strip it out.
The code.
Aspx file 1: embed code from video source
Aspx file 2: Javascript pop up code
<a onclick="window.open('YOURFILE1URLHERE,'','scrollbars=yes,resizable=yes,width=440,height=315,left='+(screen.availWidth/2-220)+',top='+(screen.availHeight/2-220)+'');return false;" href=" YOURFILE1URLHERE ">Click here to see video</a>
Embed code on page: <iframe src="YOURFILE2URLHERE" frameborder="0" width="200" height="55" scrolling="no"></iframe>
The result.
Try this example page in Firefox or IE to see it in action.