Jump to content

Submit Does Not Work In Firefox


trl
 Share

Recommended Posts

Hi All,The code for this very simple form below works as expected in IE but in Firefox a message box opens saying"What should Firefox do with this file - Open with Perl Command Line..."I have tried using Javascript Submit() - with the same outcome.Would be very grateful for some ideas.CODE.......<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=shift-jis"><title>Test</title></head><body><h1>Mail Test Form</h1><hr><form method="post" action="/cgi-bin/FormMail.pl">Name:<br><input type="text" size=50 name="NAME"><br><br><br><input type="submit" value=" Submit "><input type="reset" value=" Cancel "></form><hr></body></html>............END CODE

Link to comment
Share on other sites

The submit() is probably fine. Firefox doesn't know what to do with the result. Something in your Perl script is perhaps sending incorrect headers. Or the problem may be very simple: change the file extension from .pl to .cgi . (Firefox may think it's trying to download the Perl document itself, not the document generated by the script. It would never make that mistake with a .cgi file.) The change is worth a try, and you can always change it back if it doesn't work.

Link to comment
Share on other sites

The submit() is probably fine. Firefox doesn't know what to do with the result. Something in your Perl script is perhaps sending incorrect headers. Or the problem may be very simple: change the file extension from .pl to .cgi . (Firefox may think it's trying to download the Perl document itself, not the document generated by the script. It would never make that mistake with a .cgi file.) The change is worth a try, and you can always change it back if it doesn't work.
Thanks for the suggestion, tried it, but still no luck. Back to square one!
Link to comment
Share on other sites

Did you look at the headers Perl is sending before it sends the rest of the response? I'm talking about something like this:print("Content Type: text/html\n\n");
It seems that the server does NOT send the correct type in its header I see Content-Type: appliction/octet-streamusing LiveHTTPheaders in Firefox.My problem now is I am using NMS Formmail and can't find a way to make it work!So hoping for some help.
Link to comment
Share on other sites

Yeah, sending a Content Type header of application/something should force a download dialog to open. Normally it's used with content size and content disposition headers as well. If they are not present (especially the disposition) that might explain why some browsers don't treat it like a download, while others do.But if you are trying to generate an HTML document, the header type I showed you should work. The two newline characters at the end are essential.Now clarify a thing for me. Is it the page you pasted into your first post that isn't loading correctly? Or is it the response from FormMail.pl that doesn't load right?I'm guessing it's the response to your form. I'm also guessing that you are not a Perl author, but you're just using FormMail.pl and hoping it does its job. Which is fine. That's what it was written for. But it makes tracking down this problem a little more difficult.Now, for all I know, LiveHTTPHeaders is actually causing the problem. I've never used it myself.But if that is not the case, then it is possible that your copy of FormMail.pl has been modified so that it's sending out the incorrect content header. You could open it up in a text editor and search for Content-type. If the header looks like the one I showed you, then we have a mystery. If it looks like the thing you saw in LiveHTTPHeaders, then just make the change. (You can always change it back.)It's also worth checking out the version of FormMail to make sure yours is current. The version number and release date should be in the first few lines of the document. 1.93 is the current version at Matt's script archive: http://www.scriptarchive.com/download.cgi?s=formmail If nothing else, you could try replacing your existing copy with fresh one and see if anything new happens.

Link to comment
Share on other sites

Yeah, sending a Content Type header of application/something should force a download dialog to open. Normally it's used with content size and content disposition headers as well. If they are not present (especially the disposition) that might explain why some browsers don't treat it like a download, while others do.But if you are trying to generate an HTML document, the header type I showed you should work. The two newline characters at the end are essential.Now clarify a thing for me. Is it the page you pasted into your first post that isn't loading correctly? Or is it the response from FormMail.pl that doesn't load right?I'm guessing it's the response to your form. I'm also guessing that you are not a Perl author, but you're just using FormMail.pl and hoping it does its job. Which is fine. That's what it was written for. But it makes tracking down this problem a little more difficult.Now, for all I know, LiveHTTPHeaders is actually causing the problem. I've never used it myself.But if that is not the case, then it is possible that your copy of FormMail.pl has been modified so that it's sending out the incorrect content header. You could open it up in a text editor and search for Content-type. If the header looks like the one I showed you, then we have a mystery. If it looks like the thing you saw in LiveHTTPHeaders, then just make the change. (You can always change it back.)It's also worth checking out the version of FormMail to make sure yours is current. The version number and release date should be in the first few lines of the document. 1.93 is the current version at Matt's script archive: http://www.scriptarchive.com/download.cgi?s=formmail If nothing else, you could try replacing your existing copy with fresh one and see if anything new happens.
HiThanks for your efforts.To clarify - the problem is, as you thought, it is the response from FormMail that is causing the problem. What actually happens is I "submit" the form, and after a few moments a text box opens asking how firefox should treat the .pl file from <form method="post" action="/cgi-bin/FormMail.pl">. I am sure you have identified the problem correctly as the form does get sent and is received as expected.I am using the NMS version of Matts FormMail as sometime ago the consensus was it was very dangerous security wise - have things changed? I see the file date on Matts file is very recent so I presume he has made significant changes by now.I will try Matts new FormMail ans see what I get.Many thanks for your time.
Link to comment
Share on other sites

Yeah, Matt's had leaks a while back, and NMS fixed those. I'm pretty sure Matt's newest version is a complete revision with better ways of doing things, but it's your call, use NMS if you want. I was just concerned that something somewhere had been altered from the original.

Link to comment
Share on other sites

Yeah, Matt's had leaks a while back, and NMS fixed those. I'm pretty sure Matt's newest version is a complete revision with better ways of doing things, but it's your call, use NMS if you want. I was just concerned that something somewhere had been altered from the original.
HiHave read the release notes etc and seems to pay more attention to security so I have set it up and it works!Checked the header and content-type is now correcct - so your hypothesis has been proved correct.One again many thanks.BTW LiveHTTPheaders seems to work well with firefox - no side effects observed (as yet)
Link to comment
Share on other sites

Good deal. It didn't seem likely that LiveHTTPHeaders would be the problem (too large a user base) so, as your issue is now solved, I wouldn't worry about that. In fact, it seems to have helped us track down the real problem. You should send them some fan mail. :)

Link to comment
Share on other sites

Good deal. It didn't seem likely that LiveHTTPHeaders would be the problem (too large a user base) so, as your issue is now solved, I wouldn't worry about that. In fact, it seems to have helped us track down the real problem. You should send them some fan mail. :)
Hello AgainI am afraid I spoke / acted too soon.I find that in fact I am still having the same problem.I enclose the post and response headers as logged by IEwatch using IE8.It appears the "Response" header is exactly the same in IE and Firefox - just the page does not show in firefox - the message box opens instead.So I continue banging my head!<?xml version="1.0" encoding="UTF-8"?><HTTPLOG application="IEWatch" timestamp="2009-11-06T18:36:11" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.iewatch.com/schemas/iewatch/v3"'>http://www.iewatch.com/schemas/iewatch/v3" xsi:schemaLocation="http://www.iewatch.com/schemas/iewatch/v3 http://www.iewatch.com/schemas/iewatch/v3/...g.xsd"> <ITEM time="18:34:27.031" duration="4.984" method="POST" url="http://www.booking-by.net/cgi-bin/FormMail.pl"> <IPADDRESS></IPADDRESS> <NOTE>Thank You</NOTE> <RESULT>200</RESULT> <SIZE>592</SIZE> <REQUEST> <HEADERS> <HEADER name="(Method-Line)" value="POST /cgi-bin/FormMail.pl HTTP/1.1"/> <HEADER name="Accept" value="image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-silverlight, application/x-silverlight-2-b2, */*"/> <HEADER name="Referer" value="http://www.booking-by.net/Scripts/zzz.htm"/> <HEADER name="Accept-Language" value="en-gb"/> <HEADER name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)"/> <HEADER name="Content-Type" value="application/x-www-form-urlencoded"/> <HEADER name="Accept-Encoding" value="gzip, deflate"/> <HEADER name="Host" value="www.booking-by.net"/> <HEADER name="Content-Length" value="34"/> <HEADER name="Connection" value="Keep-Alive"/> <HEADER name="Cache-Control" value="no-cache"/> <HEADER name="Cookie" value="__utma=92524558.1759357076.1257185658.1257528288.1257528839.7; __utmz=92524558.1257185658.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=92524558.1.10.1257528839; __utmc=92524558"/> </HEADERS> <POSTDATA mimetype="application/x-www-form-urlencoded"> <RAW> <![CDATA[recipient=trl@booking-by.net&NAME=]]> </RAW> <PARAMETER name="recipient" value="trl@booking-by.net"/> <PARAMETER name="NAME" value=""/> </POSTDATA> </REQUEST> <RESPONSE> <HEADERS> <HEADER name="(Status-Line)" value="HTTP/1.1 200 OK"/> <HEADER name="Server" value="Microsoft-IIS/5.0"/> <HEADER name="Date" value="Fri, 06 Nov 2009 17:34:34 GMT"/> <HEADER name="Connection" value="close"/> <HEADER name="Content-Type" value="application/octet-stream"/> </HEADERS> </RESPONSE> </ITEM></HTTPLOG>
Link to comment
Share on other sites

When I load your Perl script's address into my address bar, I get this error message that is generated by the script itself:Error: GET requestThe HTML form fails to specify the POST method, so it would not be correct for this script to take any action in response to your request.If you are attempting to configure this form to run with FormMail, you need to set the request method to POST in the opening form tag, like this:<form action="/cgi-bin/FormMail.pl" method="post">Do you also get that, or do you get the same download thing as before? FWIW, the Content-Type header comes through as text/html . (I'm using Firefox.)

Edited by Deirdre's Dad
Link to comment
Share on other sites

I looked into NMS FormMail. The only content type header it seems to print is text/html. Which makes sense.I'm wondering if your server is properly set up to print the results of .pl documents. One of my servers prints .pl docs as the plain text of the document. It only executes if the extension is changed to .cgi . Another server doesn't care. It could be that your server is generating goofy headers on its own.Have you tried this on a different computer running Firefox? Just to be sure it's not your browser's configuration that's doing this.I already know where your script is, since you posted the address. Wanna post the address of the doc that has the form? Then I can look at the whole process.

Edited by Deirdre's Dad
Link to comment
Share on other sites

I looked into NMS FormMail. The only content type header it seems to print is text/html. Which makes sense.I'm wondering if your server is properly set up to print the results of .pl documents. One of my servers prints .pl docs as the plain text of the document. It only executes if the extension is changed to .cgi . Another server doesn't care. It could be that your server is generating goofy headers on its own.Have you tried this on a different computer running Firefox? Just to be sure it's not your browser's configuration that's doing this.I already know where your script is, since you posted the address. Wanna post the address of the doc that has the form? Then I can look at the whole process.
HiYes have tried on another computer with same result.The script address is: www.booking-by.net/scripts/zzz.htmI have tried this with diffrent scripts using java script and html but always get the same result it seems that firefox requires something that IE does not or is Firefox is just broken?
Link to comment
Share on other sites

I visited your site with Firefox 3.54 (Mac). I put several kinds of values in the form field. I got back this error message, which is built into NMS FormMail:Error: Bad or Missing RecipientNothing tried to download. Same results in Safari.

Link to comment
Share on other sites

I visited your site with Firefox 3.54 (Mac). I put several kinds of values in the form field. I got back this error message, which is built into NMS FormMail:Error: Bad or Missing RecipientNothing tried to download. Same results in Safari.
Yes a stupid mistake on my part.Ok I have now changed things - I am using Matts formmail v1.93 renamed to xyzmail.plThe html form has been renamed to xyz.htm <http://www.booking-by.net/Scripts/xyz.htm>I have tested in IE8 it works! But fails in firefox 3.5.5 as firefox asks how it should open XYZmail.plThe Headers I get returned for the success page are as I posted before. Using Firefox the recipient receives the file complete without problem it seems even though it displays the message box and whether the OK or Cancel button is clicked the message is still received. Click the cancel button and the message box just disapears - Click the OK button and firefox down loads the file XYZmail.plIn firefox the success page is never shown.Hope this helps to clarify what is happening a little more.
Link to comment
Share on other sites

Okay. I'm getting the same results. It is odd that this should happen with 2 separate scripts.Did I ask if other .pl scripts run okay or have the same problem in Firefox? I am back to the hypothesis that your server is configured incorrectly for Perl, and this test would help confirm it or rule it out. Here is a simple .pl script for you to try. Call it directly from your address bar. NOTE: the script is tested, but copy/paste sometimes fails with Perl. It can be very sensitive about line breaks. The solution is to delete all the line breaks and replace them by simply hitting your return key. Be sure to give the script execute privileges!

#!/usr/bin/perl print "Content-type: text/html\n\n"; print "hi";#end

Another possibility. If you have PHP enabled, you might try a PHP mailing script. I have no idea what's a good one, since I write my own custom mail scripts in PHP. Maybe someone else on the board knows a good one.

Link to comment
Share on other sites

Okay. I'm getting the same results. It is odd that this should happen with 2 separate scripts.Did I ask if other .pl scripts run okay or have the same problem in Firefox? I am back to the hypothesis that your server is configured incorrectly for Perl, and this test would help confirm it or rule it out. Here is a simple .pl script for you to try. Call it directly from your address bar. NOTE: the script is tested, but copy/paste sometimes fails with Perl. It can be very sensitive about line breaks. The solution is to delete all the line breaks and replace them by simply hitting your return key. Be sure to give the script execute privileges!
#!/usr/bin/perl print "Content-type: text/html\n\n"; print "hi";#end

Another possibility. If you have PHP enabled, you might try a PHP mailing script. I have no idea what's a good one, since I write my own custom mail scripts in PHP. Maybe someone else on the board knows a good one.

I put your script on the server called it DD.PL ran it from the command prompt on the server and got as expected the lines below.Content-type: text/htmlhiBut ofcourse it doesn't go anywhere near firefox it all happens on the server.Unfortunately I don't have PHP on the server.
Link to comment
Share on other sites

I put your script on the server called it DD.PL ran it from the command prompt on the server and got as expected the lines below.Content-type: text/htmlhiBut ofcourse it doesn't go anywhere near firefox it all happens on the server.Unfortunately I don't have PHP on the server.
Hi Dad received your test messages x2!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...