Capturing a var from JavaScript

Victor Subervi victorsubervi at gmail.com
Sun Oct 18 22:10:09 CEST 2009


Hi;
I have the following code:

#!/usr/bin/python

def getResolution():
  print 'Content-Type: text/html\n'
  print '''
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN' '
http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'>
<head xmlns='http://www.w3.org/1999/xhtml'>
</head>
<body>
<script language="JavaScript1.2">
var winX = screen.width;
var winY = screen.height;
'''
  x = eval('document.write(winX)')
#document.write('Your screen resolution is ' + winX + ' x ' + winY + ',
which is below the recommended size for this application. If possible,
please reset your screen resolution to 800 x 600 or higher. Thank you!');
  print '''
</script>
'''
  print x
  print '''
</body>
</html>
'''

getResolution()


It doesn't work. What I want is to capture winX and winY and use them in
python. How?
TIA,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091018/53750dfd/attachment.html>


More information about the Python-list mailing list