1

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 ?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

That's true! My page is https and widget comes from http...Any solutions ?
Choose one and use it throughout or use protocol-relative urls (ones that start with // and specify everything except the protocol)
Do you have it on the internet somewhere where we can see it? There's not really enough information in your question to debug it.
I have wasted so much time trying to have a simple countdown on my web site but couldn't get past the above issues...Eventually I have used keith-wood.name/countdown.html and it was really easy to integrate it with Web2Py. You can see see it counting down towards the dreaded ICD-10 medical coding change coming to US healthcare on Oct 1st 2014 at icd10.pythonanywhere.com/ICD10/default/index

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.