Forked from jramsahai/optionally_launch_lightbox_from_query_string.html
Created
July 1, 2014 16:07
-
-
Save joshorvis/1d3048dbaa9f4d00fc03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
www.mycompany.com - Normal website appears | |
www.mycompany.com?vidyard=true - Website appears, Vidyard player launched in lightbox | |
--> | |
<html> | |
<head> | |
<!-- Parsing the query string. Sample taken from http://javascript.about.com/library/blqs.htm --> | |
<script type="text/javascript"> | |
var qsParm = new Array(); | |
function qs() { | |
var query = window.location.search.substring(1); | |
var parms = query.split('&'); | |
for (var i=0; i<parms.length; i++) { | |
var pos = parms[i].indexOf('='); | |
if (pos > 0) { | |
var key = parms[i].substring(0,pos); | |
var val = parms[i].substring(pos+1); | |
qsParm[key] = val; | |
} | |
} | |
} | |
// Set the initial value to null so the default website pops in all other situations | |
qsParm['vidyard'] = null; | |
</script> | |
<!-- Determine the value of the vidyard parameter and launch the lightbox if true --> | |
<script type="text/javascript"> | |
function videoCheck() { | |
if (qsParm['vidyard']) { | |
// if URL ends in ?vidyard=true launch the Vidyard lightbox player. Function name is unique to player. It can be found in the lightbox embed code. This is the function name for a sample player. | |
fn_vidyard_XXXXXXXXXX(); | |
} | |
} | |
</script> | |
<!-- This script definition code can be found in the lightbox embed code. This is here as an example. --> | |
<script type="text/javascript" id="vidyard_embed_code_XXXXXXXXXX" src="//play.vidyard.com/XXXXXXXXXX.js?v=3.1&type=lightbox"></script> | |
</head> | |
<body onload="videoCheck();"> | |
Here's the website! | |
<script type="text/javascript"> | |
qs(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment