Capturing a var from JavaScript

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

I have the following code:


def getResolution():
  print 'Content-Type: text/html\n'
  print '''
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Frameset//EN' ''>
<head xmlns=''>
<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 '''
  print x
  print '''


It doesn't work. What I want is to capture winX and winY and use them in
python. How?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list