Subject: widget no longer works when served locally
Description of problem:
- create a profile widget from http://twitter.com/about/resources/widgets/widget_profile
- grab the code and insert it within a web page saved on your local pc and the view it in a web browser.
The widget will not load, It looks as if the file http://widgets.twimg.com/j/2/widget.js references the css as //widgets.twimg.com/j/2/widget.css and this would cause the browser to look for the css file at file://widgets.twimg.com/j/2/widget.css when served locally and therefore fail.
Can anything be done about this? i presume its done this way to allow the widget to be served securely in which case would something like below be a suggestion to resolve the problem?
(code untested and just a suggestion. )
var twitter_host = (("https:" == document.location.protocol) ? "https:" : "http:"); // determines whether the protocol is http or https
and then
else{s.loadStyleSheet(""+ twitter_host +"//widgets.twimg.com/j/2/widget.css",this.widgetEl)