How to make Firefox open RSS directly (like other XML files), instead of downloading? - firefox

Using Firefox 70.0.1 on Arch Linux. (I realize that this question might technically belong on SuperUser, but I suspect that no non-developer would ever need to do this.)
I'm trying to debug my code that generates an RSS feed, by viewing it directly in Firefox's XML viewer.
When I enter a feed URL, like https://en.blog.wordpress.com/feed/, Firefox pops up the dialog that asks me what to do with the file. It calls it an "RSS Summary", and I can choose to open it or save it to disk.
I can choose to open it in Firefox, but then the file is first downloaded to disk, and then opened from a file:// URL. The result is that I can't hit F5 to refresh it; I have to enter the URL anew.
This only happens if the Content-Type header is application/rss+xml. A file served up as plain application/xml (like e.g. https://xkcd.com/rss.xml uses) is opened directly.
How can I tell Firefox that application/rss+xml should receive the same treatment and just be viewed as a regular XML file?

Add the „view-source:“ prefix in front of your url as said in this article: https://css-tricks.com/snippets/html/view-source-of-rss-feed-in-firefox/

You should be able to achieve this using an extension.
There is Open in Browser which seems to resolve the issue.
When you try opening the RSS URL with the extension installed, you will be shown a window where you can choose which action to take. You can choose to open the file as XML in the browser window. If you want to be able to hit F5 and reload the file, you may also want to tick "Do this automatically for files like this from now on".
Note that I haven't read the source code of the extension so I don't know if it is safe to use or not.

Related

Open a paperclip attached word doc in Ruby/rails

I have a rails app with file attachments using paperclip. Images and pdfs work fine in that if I click on the linked attachment, the image or pdf opens. If I right click, I can do a save-as.
However, with Office files such as word.docx, I can only download the file. If I go do Dos and type the filename, it will open in MS word. Therefore, I think that I should be able to use the system or system call and just pass the attachment name from paperclip (ie attachment.image.url) to dos and the file should open. I think the command I want would be something like
system(attachment.image.url)
I can't figure out how to write the statement to do that.
Your browser will not (and should not) allow you to execute anything outside of the browser itself, this means that without some external app making the call to your Rails app from the clients machine, you will not be able to open the Word doc without downloading it.
You are able to open the images and PDFs in the browser because the browser supports them, but most browsers won't open Word docs.
You can either have the user download the file, or maybe use a third party viewer that you can open the word doc with inside the browser.

How to start "save as / open" after requesting a file from server?

I'm using MooTools as JS-Framework.
When a user clicks the "Show Report"-Button on my website I'm starting Request.HTML to retrieve the path of the requested report.
If the report does not exists yet, its been created on the server (a waiting popup is shown to the user). The report file is saved to a special path on the server and this path is returned to the browser.
After I got the path to the Report-File - the Report can reach about 5 to 8MB - I want to show the user a "Download-ProgressBar" while starting a new Request.HTML to retrieve the big report file.
Everthing until this point works fine. I got the ProgressBar filling up, after its finished I got my big file.
But my problem is now, how I can start something like "Open File" or "Save File As" from JavaScript.
I got the freaking file downloaded and shown in the console but now I want the user to save this file somewhere or to open it directly...
Kind Regard.
Why don't just show a link to that file so that it opens in a new page?
That way one can open in a new window and save from the browser's menu (or use the right click>save to menu).
Since you already have your file serialized most browsers nowadays supports the data uri scheme so if this fine to support a limited subset of browsers you can do
window.open(fileToSave, '_blank');
notably old version of IE don't support all kind of files using data-uri so it will not work for html.
There are some File API in newer browser too, and there are some other solutions involving flash but historically the right way to do this is to navigate to a server page which returns an header
Content-Disposition: attachment; filename=yourfilename.html
that will work in any browser (I used this a lot in IE6 with no particular problem).

Chrome extension: debug content script before packaging

I am developing a Chrome extension. It sets/reads local storage, reads the DOM, and sends an Ajax message. But sometimes it never reaches the server and I don't know where it gets stuck. Reloading the page doesn't work, although the extension works if I load another page in the same tab, and the original page will work if I load it in another tab. I use activeTab permission.
How can I debug this? The Chrome tutorial http://developer.chrome.com/extensions/tut_debugging.html only mentions a popup, which I do not have. (I right-click the icon and "Inspect popup" is not visible.)
I have tried plain old F12/sources, but I don't see my extension there, even when it works.
I am on localhost and the extension is not packaged. I am still working in developer mode.
The extension does not show up in developer tools>Sources>Content scripts, maybe because it isn't packaged. I can see the content script from another regular extension.
To see mine I:
Wrote the following as the first line in my script:
debugger;
Before pressing the extension icon, I bring up the developer tools: F12
Now, when I click the extension icon, my script opens under sources/program. It does not do this if the developer tools is not open.

Excel .xlsx download - sharing violation error message on Open and Save combination

I've found this question posed a few times, but no definitive answers as yet. Looks like a decent solution would help quite a few people.
So we create an excel file (.xlsx) on the server and download it to the client using content-disposition 'attachment'. The Open Save dialog appears and all works fine if you choose Save, or Open and then Save As... However if you choose Open and then hit the Save... button then Excel hangs for a moment and then presents the message:
Your changes could not be saved to 'Export[5].xlsx' because of a sharing violation. Try saving to a different file.
then:
The file you are trying to open 'F8CAC020.IE5\HM2NBE5C\F8CAC020', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
then:
you finally get the Save As: dialog (assuming you pressed 'Yes').
Code for creating the file is:
Response.Clear()
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AppendHeader("content-disposition", "attachment;filename=Export.xlsx")
Response.AddHeader("Content-Length", New System.IO.FileInfo(NewFile).Length)
Response.TransmitFile(NewFile)
Response.Flush()
If you remove the content-disposition header you get the right sort of behaviour in Excel, but with the wrong name and no guarantee that the Excel document will not instead be shown in the browser (depending on client settings). If you press Open and then Save then you
get a message:
'default.aspx' is read-only. To save a copy, click OK, then give the workbook a new name in the Save As dialog box.
So the question is how to combine the 2 behaviours into a reasonable one:
Get the nice error message directly above, when you try to Open and then Save a downloaded file, but also specify that the document should be downloaded and given a default filename.
Cheers,
James
I believe there is a bug in the IE file download code that does not acknowledge the completed file transfer (download) from the web server, thus leaving a connection to the downloaded (temporary) file open when the save is attempted. That generates the "sharing violation" message. I tried the same code with FireFox and I don't get the same result, which surely leads me to believe this is an IE-specific problem.
Unfortunately, given that I believe this to be a bug in IE, I don't think there is presently a clean resolution to this issue.

Open TFS Work Item Attachment in Image Viewer not Web Browser

Is there a way to open an attachment for a TFS work item by double clicking on it (or rather just opening it from the IDE) in your computer's default image viewer, rather than opening it in a web browser? I'd love to be able to change this setting (if it is a setting).
Edit: after reviewing Kate Gregory's response, I looked into this option and realized that the trouble is that VS is launching a url (a handler file to respond with the attachment), which results in the default web browser being launched. A potential work around i'm considering is writing a custom mapper for all web based calls (as in, when going to start->run and enter a URL) that the mapper would determine what kind of call it is (TFS, etc) and use an appropriate program, based on the MIME type responded with, with a second phase to be incorporate this as a VS add-in.
I'm reasonably sure VS just uses your default program. Word for .doc files, IE for .htm files, and (in your case I bet) IE for .jpg files. Try changing the default program you're using in Windows and see what happens.
All files saved in TFS are saved in a path that starts with the following address:
http ://{YourServerName}TFS01:8080/tfs/.../.../...&FileName={YourFileName}.{YourExt}
This means that all files are opened using the default program defined for HTTP protocol, regardless of the extension for your file.
You can probably change the default program for your HTTP protocol (if you have permissions, and usually you wouldn't) but this would also affect opening any regular web page or URL, which is probably not recommended.
I still haven't found a workaround this issue too.
Some kind of preview function in VST/Team Explorer would be nice. Then, only a minor of attachments must be opened in the browser.
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6224713-preview-attachments-in-team-explorer

Resources