Office 365 Public Site Video Pop Ups

The problem.
090413_0203_office365pu1You’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
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… 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 href=” YOURFILE1URLHERE “>Click here to see video /a>
Embed code on page:
The result.
Try this example page in Firefox or IE to see it in action.


Visit my forum » if you have any questions. For development work, you can contact me here ». And if you think this would be useful to others, feel free to share it by clicking one of the share buttons up top!