Toren
Toren

Reputation: 442

Javascript within Web2Py runs locally but not when deployed

I am trying to run a simple javascript inside a web2py VIEW that needs to fetch an external URL:

<script src="http://widgets.aapc.com/countdown/aapc_cdwidgetbox_220.js"></script>

When locally - it works great. When deployed on PythonAnywhere - it doesn't work and it doesn't throw an error.

I have tried wrap a container around it - didn't help I have tried sanitize True or False it in an XML - didn't help

There was some discussion on the web2py group more than 2 years ago about this issue - but no conclusion

To make it more interesting: another kind of javascript widget such as :

<div align="center" style="margin: 15px 0px 0px;"><noscript><div align="center" style="width:   140px; border: 1px solid rgb(204, 204, 204); text-align: center; color: rgb(249, 249, 255); font-weight: bold; font-size: 12px; background-color: rgb(4, 2, 68);"><a href="http://mycountdown.org/tag.php?tag=icd" style="text-decoration: none; font-size: inherit; color: rgb(249, 249, 255);">Icd </a></div></noscript><script type="text/javascript" src="http://mycountdown.org/countdown.php?cp2_Hex=040244&cp1_Hex=F9F9FF&img=1&hbg=&fwdt=170&lab=1&ocd=conference&text1=ICD-10&text2=My Countdown&group=Event&countdown=conference&widget_number=3010&event_time=1412121600&timezone=America/New_York"></script></div>

again - works locally but not when deployed.

Now comes THE RUB.... If a widget is in the format of:

<iframe width="350" height="240" src="//w2.countingdownto.com/468181" frameborder="0"></iframe><p><a href="http://countingdownto.com">Countdown Clocks</a></p>

It works both locally AND on hosted machine / deployed. It doesn't have any mention of JS...and it is wrapped in

<iframe>....
not <div>

Any ideas what am I doing wrong ? Not calling JQuery correctly ? Relative paths not correct ?

Upvotes: 1

Views: 359

Answers (1)

Glenn
Glenn

Reputation: 5776

It's just a guess, but I think you're accessing your page using https and then trying to load your widgets with http and your browser is rejecting it.

Upvotes: 1

Related Questions