This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Buscar en Ayuda

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

javascript problem

  • 7 respuestas
  • 1 tiene este problema
  • 14 visitas
  • Última respuesta de Bill

more options

Starting in January I have a problem downloading a .pdf file from my Credit Union. If I click on the download icon and inspect the element I find the following:

<a href="javascript:document.EStmt._Action.value='Save';javascript:document.EStmt._Selection.value='20180228_43';javascript:document.EStmt._StmtDesc.value='Regular Statement';javascript:document.EStmt._StmtDate.value='2/28/2018';document.EStmt.submit();"> </a>

The statement is downloaded without any extension so the PC does not know what to do with it. The strange thing it is the .pdf file without the .pdf extension. If I manually add the .pdf extension then the file works correctly.

The credit union provides a view icon. If I click on the view icon and inspect the element I find the following:

<a href="javascript:createEStmtWindow('../../CuEStatementsWE/EStatements/ViewOnNewPageWait.asp?DocID=20180228_43', '20180228_43');"> </a>

The window is opened displaying the statement. I can save the statement and it is saved correctly with the proper extension.

If I use a different browser the download works correctly. I am providing an image of what Edge presents when I click on the download icon.

This use to work. Does the credit union have a problem or does Firefox?

Why does it work correctly with Microsoft Edge, Internet Explorer, and Google Chrome?

Starting in January I have a problem downloading a .pdf file from my Credit Union. If I click on the download icon and inspect the element I find the following: <a href="javascript:document.EStmt._Action.value='Save';javascript:document.EStmt._Selection.value='20180228_43';javascript:document.EStmt._StmtDesc.value='Regular Statement';javascript:document.EStmt._StmtDate.value='2/28/2018';document.EStmt.submit();"><i class="icon-download-alt"></i>&nbsp;</a> The statement is downloaded without any extension so the PC does not know what to do with it. The strange thing it is the .pdf file without the .pdf extension. If I manually add the .pdf extension then the file works correctly. The credit union provides a view icon. If I click on the view icon and inspect the element I find the following: <a href="javascript:createEStmtWindow('../../CuEStatementsWE/EStatements/ViewOnNewPageWait.asp?DocID=20180228_43', '20180228_43');"><i class="icon view"></i>&nbsp;</a> The window is opened displaying the statement. I can save the statement and it is saved correctly with the proper extension. If I use a different browser the download works correctly. I am providing an image of what Edge presents when I click on the download icon. This use to work. Does the credit union have a problem or does Firefox? Why does it work correctly with Microsoft Edge, Internet Explorer, and Google Chrome?
Capturas de pantalla adjuntas

Todas las respuestas (7)

more options

I forgot to mention. With the download icon the name of the file is "CU".

With view icon the name of the file is "Statement.pdf".

With the other browsers the name of the file, using the download icon, is "02-28-2018.pdf" not "CU" with no extension.

more options

When a server sends a download, it can override the raw web address of the download with a friendlier file name. However, there are not supposed to be any spaces in a file name, so Firefox stops reading at the first space -- which is just after CU. To resolve that, the developers are supposed to either put the file name in quotation marks or fill the spaces with a character, such as an underscore (_) to avoid this problem. I suspect the Credit Union does not test in Firefox. Please escalate this issue to them!

more options

Can you point me to where you see the space after "CU". I do not see it.

more options

Hi Bill, you can see the spaces in your screenshot:

This is not part of the script in the page, it is sent by the server as part of the HTTP Headers preceding the PDF file. That's where the problem is.

more options

So what you are telling me is that the name of the file as displayed in Microsoft Edge should not be "CU Regular Statement 2-28-20108.pdf" it should be "CU_Regular_Statement_2-28-2018.pdf". I looked and the name of the file when I use the view option is because the name is "statement.pdf".

Am I correct?

more options

Bill said

So what you are telling me is that the name of the file as displayed in Microsoft Edge should not be "CU Regular Statement 2-28-20108.pdf" it should be "CU_Regular_Statement_2-28-2018.pdf".

No, that is not what I'm saying. The server is sending something like this:

Content-Disposition: attachment; filename=CU Regular Statement 2-28-20108.pdf;

Microsoft browsers disregard the rule that spaces in a header field terminate the value for that field; they read all the way to the end of the line. Therefore, they show the file name intended by the server.

Firefox stops at the first space and you get a file named CU or CU.pdf. Mozilla might be the last holdout following the standard (RFC 2616), which was originally related to supporting non-ANSI character sets but now might just be stubbornness (the fact that the standard often is disregarded has been noted in RFC 6266 Appendix A while quotation marks are still indicated when spaces are included RFC 6266 Examples). So we are where we are.

The solution is for the site to quote the file name when it constructs the header:

Content-Disposition: attachment; filename="CU Regular Statement 2-28-20108.pdf";

Hopefully they can make that minor change so everyone is happy.

more options

I think we are saying the same thing. I probably should not have put quotes around the name, since that would follow the rule. I put quotes around the name to highlight what I think the credit union is sending.