[mod_python] Redirecting to a new window

Eric Walstad eric at ericwalstad.com
Wed Jun 2 14:40:00 EDT 2004


Hi Edward,
On Wednesday 02 June 2004 13:06, Nick wrote:
> Diener, Edward wrote:
> > Maybe I should rephrase my question. How do I tell the browser to close
> > my current window and open a URL in another window from within Python ?

If I understand your question, you want a new window to pop up when the user 
clicks a link in their browser.  This can't be done directly with mod_python.  
The trick is to have your mod_python render a page that has either an anchor 
tag with a target attribute[1, 2] or java script that tells your browser to 
do something similar[3].  Remember, mod_python simply spews data to the 
client (browser).  Your browser has to figure out what to do with that data 
once it receives it.  For good reasons, mod_python cannot directly control 
the user's browser.  Think of it as writing mod_python code that writes code 
(html or javascript) that the client will interpret.

[1]<http://www.w3.org/TR/html401/present/frames.html#adef-target>
[2]<http://www.google.com/search?q=html+open+new+window>
[3]<http://www.google.com/search?q=javascript+open+new+window>

I hope that helps.

Best regards,

Eric.



More information about the Mod_python mailing list