Etsi tuesta

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.

Lue lisää

Open .bib files in new tab

  • 5 vastausta
  • 1 henkilöllä on sama ongelma
  • 15 näyttöä
  • Viimeisin kirjoittaja tor.nordam

more options

I very frequently open .bib files to get bibliographic information on scientific articles. The by far most convenient way to open these files, which are plain text files, is to just show them as text (either in the same tab, or a new tab). For example if you search for a publication on Google scholar, and click the quotation mark and then BiBTeX, you get the bibliographical information shown as text directly in the browser (see attached screenshot).

However, many other websites and journals instead give you a link to an actual .bib file, instead of just serving up the text. But since a .bib file is just a plain text file, it should be no problem for Firefox to display this text. However, when I go under settings and try to select default actions for .bib files, my only options are to either save the file, or open it with another application (i.e., not Firefox). For other file types, for example .pdf, it works to select Open in Firefox as the default action, but not for .bib files.

Is there a way to fix this problem?

I'm using Firefox 95.0.2 on Mac OS 12.1

Thanks, Tor

I very frequently open .bib files to get bibliographic information on scientific articles. The by far most convenient way to open these files, which are plain text files, is to just show them as text (either in the same tab, or a new tab). For example if you search for a publication on Google scholar, and click the quotation mark and then BiBTeX, you get the bibliographical information shown as text directly in the browser (see attached screenshot). However, many other websites and journals instead give you a link to an actual .bib file, instead of just serving up the text. But since a .bib file is just a plain text file, it should be no problem for Firefox to display this text. However, when I go under settings and try to select default actions for .bib files, my only options are to either save the file, or open it with another application (i.e., not Firefox). For other file types, for example .pdf, it works to select Open in Firefox as the default action, but not for .bib files. Is there a way to fix this problem? I'm using Firefox 95.0.2 on Mac OS 12.1 Thanks, Tor
Liitetyt ruutukaappaukset

Valittu ratkaisu

This site actually has both issues -- it specifies Content-Disposition: attachment, which always triggers the download dialog, and it has a novel Content-Type instead of text/plain.

Firefox will allow changing the application to open the file to Firefox on a case-by-case basis (when the BIB file has "Always Ask" selected on the Settings page), but it won't save Firefox as the default application. I think this was changed because in the old days, setting Firefox as the default application could cause an infinite loop: Firefox repeatedly opens empty tabs or windows after you click on a link.

One possible workaround is an add-on I wrote which can change the content type for specific file extensions:

https://addons.mozilla.org/firefox/addon/content-type-fixer/

Here are the steps to address the issue using the extension.

After installation, click its toolbar button to start the listener. Then click it again to open the menu and set up the Content-Disposition override (set it to "Follow my settings (inline)").

Next, start the download so it is logged by the extension; you can cancel after the dialog appears.

Use the menu to open the log.

On the log page, find the row for the BIB file and click the Add button to open a form to assign text/plain to it. Then click Save Content-Type and you're ready to test whether it worked.

Assuming all went well, the next time you click the button, Firefox will show the response in a tab. If you encounter a site where that causes a problem, you can turn off the extension using the top item on the menu. Or you could simply turn the extension on/off when you need it.

Lue tämä vastaus kontekstissaan 👍 1

Kaikki vastaukset (5)

more options

There is a change in Firefox 96 related to cookies and insecure sites.

See also:

As a workaround for now you can modify this pref on the about:config page to revert this change.

  • about:config => network.cookie.sameSite.laxByDefault = false

You can open the about:config page via the location/address bar. You can accept the warning and click "I accept the risk!" to continue.


If you use extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) that can block content (Adblock Plus, NoScript, DuckDuckGo PE, Disconnect, Ghostery, Privacy Badger, uBlock Origin) always make sure such extensions do not block content.

Firefox shows a purple shield instead of a gray shield at the left end of the location/address bar in case Enhanced Tracking Protection is blocking content. You can click shield icon for more detail and possibly disable the protection. You can check the Web Console for relevant-looking messages about blocked content.


You can try these steps in case of issues with webpages:

You can reload webpage(s) and bypass the cache to refresh possibly outdated or corrupted files.

  • hold down the Shift key and left-click the Reload button
  • press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
  • press "Command + Shift + R" (Mac)

Clear the Cache and remove the Cookies for websites that cause problems via the "3-bar" Firefox menu button (Settings).

"Remove the Cookies" for websites that cause problems:

  • Settings -> Privacy & Security
    Cookies and Site Data: "Manage Data"

"Clear the Cache":

  • Settings -> Privacy & Security
    Cookies and Site Data -> Clear Data -> [X] Cached Web Content -> Clear

Start Firefox in Troubleshoot Mode to check if one of the extensions ("3-bar" menu button or Tools -> Add-ons -> Extensions) or if hardware acceleration or userChrome.css is causing the problem.

  • switch to the DEFAULT theme: "3-bar" menu button or Tools -> Add-ons -> Themes
  • do NOT click the "Refresh Firefox" button on the Troubleshoot Mode start window
more options

tor.nordam said

However, many other websites and journals instead give you a link to an actual .bib file, instead of just serving up the text. But since a .bib file is just a plain text file, it should be no problem for Firefox to display this text.

Firefox isn't so concerned with file extensions. It mostly takes its cue from the Content-Type header sent by the server. If the server is properly configured, it most likely sends "text/plain" for .bib files and Firefox should immediately display it. However, some servers may send another Content-Type that Firefox doesn't understand to be a format it should display in a tab.

Secondarily, sites can trigger Firefox's Open/Save/Cancel download dialog by setting Content-Disposition to "attachment". This is going to change in Firefox 97 (most likely) where the download workflow is expect to change to saving automatically and opening the downloads list in case you want to open/view the file.

Can you give an example of a site where you have this problem? Please insert a space before the top level domain (i.e., before the .com or .edu) so that the link is broken. That will save your reply a trip to the spam moderation queue.

more options

Hi,

Thanks for the reply. On this page, there is a link to download a .bib file (see attached screenshot):

https://iopscience.iop .org/article/10.1088/1748-9326/ab6d7d/meta

When I click this link, I get a dialogue asking what I want to do with the file. Here, I can select "Open with Firefox", in which case it downloads the file, and then opens it in a new Firefox window (not a new tab). But even if I check the box to automatically do this for this filetype in the future, I get the same dialogue next time (also after restarting Firefox).

(In my original question I had tried going into preferences, and selecting Firefox as the app to open .bib files with, but then it wouldn't even store Firefox as the default app. When selecting Firefox from this dialogue, it at leasts remembers Firefox as the default choice the next time the dialogue opens, even if it ignores the part about doing this automatically. So this is a small step forward, but just opening in a new tab without questions would be more convenient.)

more options

Valittu ratkaisu

This site actually has both issues -- it specifies Content-Disposition: attachment, which always triggers the download dialog, and it has a novel Content-Type instead of text/plain.

Firefox will allow changing the application to open the file to Firefox on a case-by-case basis (when the BIB file has "Always Ask" selected on the Settings page), but it won't save Firefox as the default application. I think this was changed because in the old days, setting Firefox as the default application could cause an infinite loop: Firefox repeatedly opens empty tabs or windows after you click on a link.

One possible workaround is an add-on I wrote which can change the content type for specific file extensions:

https://addons.mozilla.org/firefox/addon/content-type-fixer/

Here are the steps to address the issue using the extension.

After installation, click its toolbar button to start the listener. Then click it again to open the menu and set up the Content-Disposition override (set it to "Follow my settings (inline)").

Next, start the download so it is logged by the extension; you can cancel after the dialog appears.

Use the menu to open the log.

On the log page, find the row for the BIB file and click the Add button to open a form to assign text/plain to it. Then click Save Content-Type and you're ready to test whether it worked.

Assuming all went well, the next time you click the button, Firefox will show the response in a tab. If you encounter a site where that causes a problem, you can turn off the extension using the top item on the menu. Or you could simply turn the extension on/off when you need it.

more options

Thank you muchly! This works perfectly.