Recent activity
Subscribe to this feed
Charlie Voss asked a question in Widgetbox on April 12, 2009 04:06:
Why won't my dynamic Javascript work with the YouTube widget?My site sniffs out the users browser settings, and based on what it finds, it loads 1 of three different css files.
The css files call for different column sizes of the page content. Why am I telling you this?
Well, because I created a YouTube widget. I created 3, actually (so I could have 3 different sizes). Based on the users browser settings, I'm using Javascript to dynamically load one of the three widgets.
I do this in lots of places in my site, and haven't had any problems, but for some reason when I do this with the Widgetbox YouTube widget, all I receive on my page is a 1-inch square box that says "No widget found".
Here's the code...it's not throwing any errors. I can't figure out what's happening. Am I unable to call Widgetbox widgets this way?
(I intentionally modified the script tags so I could get this code to post).
script language="javascript" type="text/javascript">
function GetScript(scriptFile) {
return "script type=\"text/javascript\" src=\"http://cdn.widgetserver.com/syndication/subscriber/InsertWidget.js\"><\/script>script>if (WIDGETBOX) WIDGETBOX.renderWidget(\'+ scriptfile\' );<\/script>"
}
function SetScript() {
if (screen.width <= '1024') {
return GetScript('afd166d3-f537-4b26-85e8-b731ca1aa1c6');
}
else if (screen.width > '1024' && screen.width < '1400') {
return GetScript('afd166d3-f537-4b26-85e8-b731ca1aa1c6');
}
else if (screen.width > '1400') {
return GetScript('70e5819e-e86f-4aa0-a85f-cd6d9dd5e09d');
}
else {
return GetScript('afd166d3-f537-4b26-85e8-b731ca1aa1c6');
}
}
document.write(SetScript());
/script>
Loading Profile...
