changing src reference based upon https

Posted by spody on Stack Overflow See other posts from Stack Overflow or by spody
Published on 2010-04-07T18:46:40Z Indexed on 2010/04/14 6:23 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

I'm adding a facebook comment widget to a website. I'm placing this widget in a file that is included on everypage. The navigation is relatively linked so it switches back and forth from http and https. But for some reason the comment widget only shows up if both the src linked file and webpage is secure or both the src linked file and webpage is NOT secure. The widget does not display of the src file is secure and the webpage is not secure. So... I've tried this but doesn't work.

if (window.location.protocol == 'https:')
script.setAttribute('src', 'https://ssl.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php');
}
else
{
script.setAttribute('src', 'http://static.ak.connect.facebook.com/connect.php/en_US')
}

© Stack Overflow or respective owner

Related posts about facebook

Related posts about https