473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Python CGI not working in Firefox but does in IE

I have this Python CGI script running:

Expand|Select|Wrap|Line Numbers
  1. print 'Content-type: text/plain\n'
  2.  
  3. location = 'http://server1.com'
  4.  
  5. page = '''
  6. <html>
  7. <head>
  8. <meta http-equiv="Refresh" content="0; URL='''+location+'''">
  9. </head>
  10. <body></body>
  11. </html>'''
  12.  
  13. print page
  14.  
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

Feb 22 '06 #1
5 2545

"Harlin Seritt" <ha**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
[code]
print 'Content-type: text/plain\n'


That's your problem. You've said text/plain when you meant text/html.

Feb 22 '06 #2

Harlin Seritt wrote:
I have this Python CGI script running:

Expand|Select|Wrap|Line Numbers
  1.  print 'Content-type: text/plain\n'
  2.  location = 'http://server1.com'
  3.  page = '''
  4.  <html>
  5.  <head>
  6.  <meta http-equiv="Refresh" content="0; URL='''+location+'''">
  7.  </head>
  8.  <body></body>
  9.  </html>'''
  10.  print page
  11.  

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

Feb 22 '06 #3
Ack... I'm an idiot... Thanks Richard -- You're the Man!

Feb 22 '06 #4

Iain King wrote:
Harlin Seritt wrote:
I have this Python CGI script running:

Expand|Select|Wrap|Line Numbers
  1.  > print 'Content-type: text/plain\n'
  2.  >
  3.  > location = 'http://server1.com'
  4.  >
  5.  > page = '''
  6.  > <html>
  7.  > <head>
  8.  > <meta http-equiv="Refresh" content="0; URL='''+location+'''">
  9.  > </head>
  10.  > <body></body>
  11.  > </html>'''
  12.  >
  13.  > print page
  14.  > 

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

Feb 22 '06 #5
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....929fab0d414b2c
shows how do do a redirect with HTTP headers.

Kent
Feb 22 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: qwweeeit | last post by:
Hi all, when I moved from Windows to Linux I choosed Python as my language of reference and as GUI, Qt (not much investigated up to now). Till now I didn't regret but one thing: Python can't act...
159
by: petantik | last post by:
Are there any commercial, or otherwise obfuscators for python source code or byte code and what are their relative advantages or disadvantages. I wonder because there are some byte code protection...
2
by: neeebs | last post by:
Hi, I'm not sure if this is a javascript problem per se, but here goes. I have an xsl document with a python function defined within a <script> block. Elsewhere in the xsl file, within a python...
2
by: zelegolas | last post by:
Hi, It's may be a stupid question but do you if someone tried to create a python plugin for firefox? If you know an Open Source project let me know... Thanks
2
by: Joe Goldthwaite | last post by:
I'm confused. (Not a new experience). I've got a web application running under Zope. I use the Wing IDE for testing and debugging. When trying to recreate problems that come up on the web, I...
0
by: Guilherme Polo | last post by:
On Tue, Jul 1, 2008 at 9:51 PM, Joe Goldthwaite <joe@goldthwaites.comwrote: You need sqlite itself (www.sqlite.org) and bindings, pysqlite 2 (http://oss.itsystementwicklung.de/trac/pysqlite/) or...
0
by: Joe Goldthwaite | last post by:
Thanks Guilherme. That helped. I guess I was thinking that pysqlite would automatically come with some version of sqlite. The fact that it doesn't is what was causing me to get the strange...
0
by: bruce | last post by:
hi mike.... you might look at/into selenium, or firewatir.... check the spellings! -peace -----Original Message-----
2
Subsciber123
by: Subsciber123 | last post by:
I am working on a program that would make firefox accessible to locked-in patients. What I need to be able to do is from python, find all the links and buttons on the active web page. I need to be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.