Эта тема была архивирована. Если вам нужна помощь, задайте новый вопрос.
File type .cbv displays contents rather than gives download options
I've just changed website hosting supplier; both old and new suppliers run Linux services. My site is scottishcca.co.uk - a correspondence chess site - and I'm using Win7 and Firefox 26.0. There's a page (members/downloads) where members can download e-magazines and files of chess games - the page is password protected using htaccess/htpasswd which works ok. Each e-magazine has 4 download links: pdf, zip and pgn all work correctly, but cbv does not - it just displays file contents in the browser page. What should happen is that the browser should bring up a dialogue box asking if the file should be opened with ChessBase 11 Database Software (which is associated with the .cbv file type on my computer - I checked my Default Program settings). The .pgn file type is also associated with ChessBase 11 Database Software and works correctly - the dialogue box allows me to open or save. All the links work correctly when I use Google Chrome. I'm puzzled - advice please! Iain
I think I have a fix for this. I went back to my new hosting supplier (easyspace) and received this reply: 'Hi Iain, I have done some research on this for you and have a suggestion for you to try. It is possible that Firefox is not recognising the MIME Type of application/cbv as it is not an IANA registered MIME Type. You could instead try application/octet-stream which is a generic MIME Type for non-text files. This idea came to me while reading the page at https://developer.mozilla.org/en/docs/Properly_Configuring_Server_MIME_Types and this document may give you more of an idea as to why this is not working in Firefox. Can you give this a try please and let me know how you get on. Best Regards, Gerry Munn Support Services I implemented Gerry's suggestion via .htaccess in my root directory and everything now works (after clearing Firefox cache). Maybe you could send Gerry a certificate of proficiency!Прочитайте этот ответ в контексте 👍 0
Все ответы (20)
Firefox > Options > Applications. Look for that file type, and change its action to Always Ask.
I looked for that file type in Firefox > Options > Applications, but it doesn't exist. There doesn't seem to be a way I can add a new file type. Iain
Try going back to Applications and switch EVERYTHING to Always Ask. You can redo the automatic stuff later.
I set everything to Always Ask (apart from Podcasts and Web Feeds which didn't give that option). I went back to download links, but got exactly the same results - 3 worked correctly, but .cbv just displayed file contents. Iain
Hmm. Try to
Start Firefox in Safe Mode
BTW, did you know you have two Adobe PDF Plug-In For Firefox and Netscape add-ons?
Firefox generally assesses what to do with web content not by the file extension but by the content type header sent by the server. To see what the server is sending, try using Firefox's Web Console.
After opening the page with the link, open the Web Console (Ctrl+Shift+k), then click the link. The URL should appear in the console. If you click it, Firefox will display the Request and Response headers. Check the Response Headers for the content-type. My suspicion is that Apache doesn't know what a CBV file is, so it is sending "text/plain" or "text/html" which Firefox is dutifully obeying.
To send the correct content type for this media, you can use AddType in your .htaccess file. (You can search for advice on this from sites that help webmasters or on Apache's site.)
Note: If the link to the CBV has a target attribute to open in a new tab, you need to drag the link to the address bar and drop it there, or copy the link and paste it there and press Enter, to get the URL to appear in the Web Console for the current tab.
First, I tried Fred's suggestion of starting Firefox in safe mode - problem persisted.
Second, I tried jscher2000's ideas (I'm still in safe mode here). Got the console running. When I clicked the pdf, zip and pgn links I could see GET url in the console display. When I clicked cbv, nothing appeared in the console and the bowser window showed data content as before. I then tried adding AddType application/cbv .cbv to my .htaccess file, but no joy - but I'm a rookie here, so maybe my syntax is wrong. Iain
Hi Iain, in case Firefox used the cached file, try using Ctrl+Shift+r to reload the "page" so Firefox has to re-read the headers from the server.
You can use the Live Http Headers extension to check the server response and the the content type or open the link in a tab and check Tools > Page Info > General.
I restarted Firefox and reloaded the page with Ctrl/Shift/r. I can now see GET http://www.scottishcca.co.uk/members/mag124.cbv plus The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page. in the console, but the browser window continues to show file content.
I installed the Live Http Headers extension but am having difficulty seeing any output. The only Tools menu I can see is the Web Developer one, and I've tried Live Http Headers options to open a new tab for reporting, but nothing showing.
You first have to open he LHH extension, either via a toolbar button that you can drag on a toolbar or via the Tools menu (press F10 or tab the Alt key or use Alt+T).
- Firefox menu button > Options
- View > Toolbars (press F10 to display the hidden Menu bar)
- Right-click empty toolbar area
Once you have the LHH window, you can check off additional boxes on the Generator tab and open or download the .cbv file and check the HTTP response headers.
Thanks cor-el - I've got LHH working, with everything checked in the Generator tab. The only message displaying is: #request# GET http://www.scottishcca.co.uk/members/mag124.cbv and the browser window continues to show file content.
Does Live HTTP Headers show that the server still is not sending the updated content type?
Is the URL a direct URL, or do you have a script file (e.g., index.php) intercepting the request and pulling the file from another location? If a script is used, then the server may default to the content type for the script file instead of the ultimate file that's being delivered. In that cause, you will need to set the content type in the script.
The only line recorded by LHH is as shown on my last post. There's no script involved, just direct html, viz: <td align="center">| <a href="members/mag124.cbv">cbv</a> |</td>
When the gibberish is displayed, could you check the Page Info dialog? Either:
- right-click and choose View Page Info > General
- Tools menu > Page Info > General
What this dialog shows as the "Type" usually is the Content-Type sent by the server. I'm guessing it is not application/cbv.
Type shown is text/plain, render mode is Quirks mode, encoding is windows-1252.
The .htaccess change didn't take; I'm not sure why not. But the server needs to be cajoled into sending the correct content type one way or another. Does your hosting have a control panel where you can enter content types?
I don't see anything on my hosting control panel that can do that. I've re-opened the ticket I had with them (they advised me to contact you as they didn't think it was a server problem; reasonably enough, as IE and Chrome were working ok). I've asked them if there are any Apache or other commands I can use. More tomorrow I hope...
I think I have a fix for this. I went back to my new hosting supplier (easyspace) and received this reply: 'Hi Iain, I have done some research on this for you and have a suggestion for you to try. It is possible that Firefox is not recognising the MIME Type of application/cbv as it is not an IANA registered MIME Type. You could instead try application/octet-stream which is a generic MIME Type for non-text files. This idea came to me while reading the page at https://developer.mozilla.org/en/docs/Properly_Configuring_Server_MIME_Types and this document may give you more of an idea as to why this is not working in Firefox. Can you give this a try please and let me know how you get on. Best Regards, Gerry Munn Support Services I implemented Gerry's suggestion via .htaccess in my root directory and everything now works (after clearing Firefox cache). Maybe you could send Gerry a certificate of proficiency!
Изменено Iain Mackintosh