Firefox opening infinite number of tabs when trying to open .m files from link in UBUNTU
I am trying to open a link to a .m (MATLAB) file directly in the Firefox browser (from a local site).
On windows this works fine and when the link is followed a new tab is created with the .m file converted to a HTML page.
On Ubuntu however it seems like Firefox is iterpreting the file as Objective-C source code and when I am trying to use Firefox to open the file (preferences -> applications -> Objective-C source code -> use Firefox) it keeps on repeatedly opening new emtpy tabs. I can set it so that the file is opening in e.g. gedit, but I would like to have the same behavior as on Windows i.e. a new tab with the file converted to HTML format. Is this possible? Is there a Firefox extension that I am missing? I read that you should use preview in firefox, but I don't seem to have that option (I have included a screen)
I am using Firefox Version 65.0 (64-bit)
Chi tiết hệ thống bổ sung
- Chuỗi đại diện người dùng: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
Thông tin chi tiết
Yes, this occurs when Firefox can't handle a type of content it has been instructed to send to itself: Firefox repeatedly opens empty tabs or windows after you click on a link.
I don't know the difference between Windows and Linux builds when it comes to MATLAB .m files. Do you notice any difference in extensions between your Firefox and Linux installations that might be relevant?
Do you have the correct fonts installed?
What happens if you change (add) a .html file extension?
You would normally need to use a web server to do conversions or at least make the page behave as an HTML page or there would be a script embedded in the page to use images instead of fonts.
Người tạo câu hỏi
Thank you for the replies.I think you are right, on windows I get redirected to a server where the file is stored which is doing the conversion and on my ubuntu machine it tries to download the file localy. I looked in the source code of the site and if I follow the link that is written in the source it seems to work on my ubuntu machine. So maybe there is a java script issue?
Người tạo câu hỏi
I have found that if I add "view-source:" before the link like so: view-source:http://x/y.m. It works, is it possible to set in preference that if there is a link to a .m file it opens it in source mode?
Hi user9015897, that's a very resourceful idea. I actually don't know how you could "switch" the protocol from http/https to view-source. Unfortunately, links in web pages can't go to a view-source address (so modifying the link doesn't work).
On Windows, if I execute a command line such as the following, Firefox does accept the view-source: protocol:
"C:\Program Files\Mozilla Firefox\firefox.exe" -url "view-source:https://support.mozilla.org/en-US/questions/1261530#answer-1231296"
I don't know how to translate that for Linux, but as a temporary workaround, perhaps you could create a script that just takes the true URL and creates that kind of command line. ??
It might be possible for an add-on to hook into the Content-Type of .m files the way they hook RSS feeds and grab the file. I haven't looked into how they do that.
Người tạo câu hỏi
hi, Thank you for the answer. yes, writing this in the linux terminal works: firefox -url view-source:https://support.mozilla.org/en-US/questions/1261530#answer-1231296 I am currently using Selenium and geckodriver to automate a process where part of that process is to access this link. I'll see if I can use this workaround. Thank you
Doesn't create Selenium create a new profile folder on each start? In that case it would be weird to get multiple tabs opening because only default actions should be available.
Is there a default application for the ".m" file extension?
- xdg-mime query filetype *.m