Python CGI not working in Firefox but does in IE

Discussion in 'Python' started by Harlin Seritt, Feb 22, 2006.

  1. I have this Python CGI script running:

    Code:
    print 'Content-type: text/plain\n'
    
    location = 'http://server1.com'
    
    page = '''
    <html>
    <head>
    <meta http-equiv="Refresh" content="0; URL='''+location+'''">
    </head>
    <body></body>
    </html>'''
    
    print page
    
    It works fine and redirects perfectly when using Internet Explorer but
    only shows this in a Firefox window:

    [OUTPUT]
    <html>
    <head>
    <meta http-equiv="Refresh" content="0; URL=http://server1.com">
    </head>
    </html>
    [/OUTPUT]

    Is there anything I can do to fix this?

    Also, is there a redirect command somewhere within Python CGI that can
    get this done instead as I would actually prefer to have the CGI code
    execute this rather than depend on the HTML to do it.

    Thanks,

    Harlin Seritt
    Harlin Seritt, Feb 22, 2006
    #1
    1. Advertising

  2. "Harlin Seritt" <> wrote in message
    news:...

    >
    Code:
    > print 'Content-type: text/plain\n'[/color]
    
    That's your problem. You've said text/plain when you meant text/html.
    Richard Brodie, Feb 22, 2006
    #2
    1. Advertising

  3. Harlin Seritt

    Iain King Guest

    Harlin Seritt wrote:
    > I have this Python CGI script running:
    >
    >
    Code:
    > print 'Content-type: text/plain\n'
    >
    > location = 'http://server1.com'
    >
    > page = '''
    > <html>
    > <head>
    > <meta http-equiv="Refresh" content="0; URL='''+location+'''">
    > </head>
    > <body></body>
    > </html>'''
    >
    > print page
    > 
    >
    > It works fine and redirects perfectly when using Internet Explorer but
    > only shows this in a Firefox window:
    >
    > [OUTPUT]
    > <html>
    > <head>
    > <meta http-equiv="Refresh" content="0; URL=http://server1.com">
    > </head>
    > </html>
    > [/OUTPUT]
    >
    > Is there anything I can do to fix this?
    >
    > Also, is there a redirect command somewhere within Python CGI that can
    > get this done instead as I would actually prefer to have the CGI code
    > execute this rather than depend on the HTML to do it.
    >
    > Thanks,
    >
    > Harlin Seritt


    this snippet works (from code I wrote to implement a shoutbox):

    print '''<html>
    <head>
    <meta http-equiv="refresh" content="0;URL='''+HOME+'''" />
    </head>
    <body>
    <p>Please wait...</p>
    </body>
    </html>'''

    I assume your version doesn't work because of the uppercase 'R'.

    Iain
    Iain King, Feb 22, 2006
    #3
  4. Ack... I'm an idiot... Thanks Richard -- You're the Man!
    Harlin Seritt, Feb 22, 2006
    #4
  5. Harlin Seritt

    Iain King Guest

    Iain King wrote:
    > Harlin Seritt wrote:
    > > I have this Python CGI script running:
    > >
    > >
    Code:
    > > print 'Content-type: text/plain\n'
    > >
    > > location = 'http://server1.com'
    > >
    > > page = '''
    > > <html>
    > > <head>
    > > <meta http-equiv="Refresh" content="0; URL='''+location+'''">
    > > </head>
    > > <body></body>
    > > </html>'''
    > >
    > > print page
    > > 
    > >
    > > It works fine and redirects perfectly when using Internet Explorer but
    > > only shows this in a Firefox window:
    > >
    > > [OUTPUT]
    > > <html>
    > > <head>
    > > <meta http-equiv="Refresh" content="0; URL=http://server1.com">
    > > </head>
    > > </html>
    > > [/OUTPUT]
    > >
    > > Is there anything I can do to fix this?
    > >
    > > Also, is there a redirect command somewhere within Python CGI that can
    > > get this done instead as I would actually prefer to have the CGI code
    > > execute this rather than depend on the HTML to do it.
    > >
    > > Thanks,
    > >
    > > Harlin Seritt

    >
    > this snippet works (from code I wrote to implement a shoutbox):
    >
    > print '''<html>
    > <head>
    > <meta http-equiv="refresh" content="0;URL='''+HOME+'''" />
    > </head>
    > <body>
    > <p>Please wait...</p>
    > </body>
    > </html>'''
    >
    > I assume your version doesn't work because of the uppercase 'R'.
    >
    > Iain


    There's a well known phrase about the word 'assume'...

    Iain
    Iain King, Feb 22, 2006
    #5
  6. Harlin Seritt

    Kent Johnson Guest

    Harlin Seritt wrote:
    > Also, is there a redirect command somewhere within Python CGI that can
    > get this done instead as I would actually prefer to have the CGI code
    > execute this rather than depend on the HTML to do it.


    http://groups.google.com/group/comp.lang.python/msg/6e929fab0d414b2c
    shows how do do a redirect with HTTP headers.

    Kent
    Kent Johnson, Feb 22, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ollie
    Replies:
    0
    Views:
    358
    Ollie
    Oct 2, 2003
  2. smartin
    Replies:
    0
    Views:
    347
    smartin
    Jan 27, 2005
  3. Replies:
    9
    Views:
    566
  4. Replies:
    0
    Views:
    581
  5. Replies:
    2
    Views:
    1,401
    Adrienne Boswell
    Jan 10, 2007
Loading...

Share This Page