tags:

views:

77

answers:

3

When I try to open a page with following code on Firefox, Firefox opens a download dialog box. The same code works fine on IE and Maxthon. The same problem is happening on Safari browser also.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <script type="text/javascript" src="widgEditor.js"></script>
        <title>Job Listing Entry</title>
    </head>
    <body>
        <Form id="frmNewEntry" method="post" action="insert_listing.php">
                <table id="tblEntry" cols="2" border="0">
                        <tr><td>Date:</td><td><input id="LDate" name="LDate" type="text" size="50">[yyyy/mm/dd]</td></tr>
                        <tr><td>Places:</td><td><input id="Places" name="Places" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"></td></tr>
                        <tr><td>Company:</td><td><input id="Company" name="Company" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"></td></tr>
                        <tr><td>Designation:</td><td><input id="Designation" name="Designation" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"></td></tr>
                        <tr><td>Project Details:</td><td><textarea class="widgEditor" id="ProjectDetails" name="ProjectDetails" cols="100" rows="10""></textarea> <br></td></tr>
                        <tr><td>Desired Candidate:</td><td><textarea class="widgEditor" id="DesiredCandidate" name="DesiredCandidate" rows="5" cols="100" onblur="this.value=MakeInitialCapital(this.value);"></textarea> <br></td></tr>
                        <tr><td>HR Name:</td><td><input id="HRName" name="HRName" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"> <br></td></tr>
                        <tr><td>HR Contact:</td><td><input id="HRContact" name="HRContact" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"> <br></td></tr>
                        <tr><td>Email:</td><td><input id="Email" name="Email" type="text" size="50"> <br></td></tr>
                        <tr></tr>
                        <tr><td><input id="Submit" name="Submit" value="Submit" type="submit"> <br></td></tr>
                </table>
        </Form>
    </body>
</html>

<script language="JavaScript" type="text/javascript">
    function MakeInitialCapital(str)
    {
       return str.toLowerCase().replace(/\b[a-z]/g, cnvrt);
        function cnvrt() {
            return arguments[0].toUpperCase();
        }

    }
</script>
A: 

You're not closing your initial meta tag, in head. That might be causing some problems.

Change to:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
David Hedlund
@d: Issue still persists.
RPK
The doctype is old-school HTML, not XHTML. The original non-self-closing syntax was correct.
bobince
@bobince: granted! but it stuffs up the syntax highlighting at SO, and thus obscures other possible errors in the markup =) Altho the document *can* be opened in firefox as it is, so it is probably rather an issue of how the server is serving the page, such as the content-type headers as suggested by fyjham.
David Hedlund
+2  A: 

The code looks fine other than some small things like Form instead of form and the script tag that is outside of the html but these should not cause the behavior you are describing. It could be related to the Content-Type header the web server is sending and a possible presence of a Content-Disposition header when it serves the request.

What happens if you replace your markup with a simple HTML page:

<html>
<head>
    <title>test</title>
</head>
<body>
    <div>test</div>
</body>
</html>
Darin Dimitrov
I am using simple html tag, isn't it. What else you mean to say?
RPK
@RPK: it's a server configuration issue, nothing to do with the html code.
wds
@wds: What type of configuration?
RPK
+3  A: 

Hey,

I'd try running the page through a validator, but the things that stand out instantly:

  1. Meta tag in head not closed - I'd be surprised if that did it though.
  2. JavaScript outside the <html></html> tags - This ay be your culprit.

Other than that I'd make sure the HTTP header Content-Type is set properly (Should be "text/html" - there's a few other legal values too but judging by your meta-tags that's what you're intending to serve it as). Firebug (firefox addon) should let you see this.

Tim Schneider
@fyjham: Where must be the JavaScript code if I want to place it in the same file?
RPK
+1, check the HTTP Content-Type. I've been burned by this before.
orip
I have given the entire code. What 'content-type' improvement is needed?
RPK
Hey RPK, the content-type I'm referring to is in the HTTP headers served by the webserver. Firebug will allow you to view these if you install it, they're not actually part of the HTML. As far as the script tags go, right before the body closing tag (</body>) is the usual spot.
Tim Schneider
@fyjham: How I can modify the headers in the server?
RPK
Will depend on the language you're using for the page... I'm going to assume it's PHP cause that's what you're posting to, in that case you'd just put something like <?php header('Content-type: text/html'); ?> on the page. If this solves the problem then you may want to look into reconfiguring the defaults on the server (Because if you don't specify otherwise it should serve in that content type for a php file). If it's a static file I'd need to know what webserver it's running on.
Tim Schneider