Unable to replicate examples of running ironpython in browser with silverlight
Basically i am followi开发者_如何学运维ng this tutorial: http://blog.jimmy.schementi.com/2010/03/pycon-2010-python-in-browser.html According to it, this code should run fine:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript"
src="http://gestalt.ironpython.net/dlr-20100305.js"></script>
<script type="text/python" src="http://github.com/jschementi/pycon2010/raw/master/repl.py"></script>
</head>
<body>
<script type="text/python">
window.Alert("Hello from Python!")
</script>
</body>
</html>
And in fact, it does, for example here: http://ironpython.net/browser/examples/pycon2010/start.html
You will see it if you have silverlight installed.
But the problem is that when I try to make the same code run on my PC, I can't do it. I create a text file, copy this code there, save it as test.html, and run with firefox, but nothing happens. Code does not execute, i just get a blank page. I can't understand the reason why the same code runs here: http://ironpython.net/browser/examples/pycon2010/start.html, but not on my PC, given that it is a client side code, and not the server side.
It's failing to download repl.py; looks like a bug as it's falling back to the DOM downloader when doing cross-domain downloads, but throws. As a work-around copy it to your web-server as well; here's it working: http://www.schementi.com/silverlight/Sunny88.html.
Also, locally you must run under a local web-server as Silverlight isn't able to download any files from the http:// zone while running from the file:// zone.
精彩评论