When I send a .html file as an attachment it opens in a new browser tab when it is clicked on. I want it to download as normal attachments are.
Is there a solution to this problem. Perhaps a programming solution? Or perhaps a file extension that downloads from emails but opens normally in a browser when clicked on?
I know that the recipient can right click and click download or something but I want the sender to be able to control whether or not it is downloaded or opened in a new tab.
Does a file extension that opens with browsers by default but downloads normally from emails exist?
Your webserver is sending a content-type header of type "text/html", and your clients' browsers are acting on that header. If you can tell your server to send "application/octet-stream", then the browsers will ask the users what to do with the file.
Maybe try changing the file extension to .php might work. PHP files are basically html files, but they expect PHP code in there - doesn't mean there has to be though. (This may work for other code language extensions too).
Not sure if the whole workflow will play out the way you want it, but worth a try...
Related
I'd like to add a "Reply" button in my web application which can open a .eml email in the user's default mail application (eg Outlook), and hit "Reply".
mailto is clearly not an option since html bodies don't seem to be possible.
Any easy way to do this? Note that the server does have the .eml file
Some browsers has the option to automatically save downloaded files to a folder, without prompting the user where to save the file. This has posed a problem for us where the user automatically saves the file in "Downloads" instead of selecting a proper location.
Is there any HTML-attribute, HTTP-header or JavaScript solution to instruct browsers to prompt for save location for downloaded files even though they are configured otherwise?
Note: I am well aware that this is probably not possible, but wanted to see if someone hopefully can prove me wrong.
Related issues:
How to make browser download link target instead of navigate: Force to open "Save As..." popup open at text link click for pdf in HTML
No. It's a browser preference. If the user prefers not to be bothered by their browser for download locations, then that's their prerogative. They'll deal with the file location after it has been downloaded. A server cannot influence that behaviour.
For my Trac plugin, I have made an export script which converts contents to a different format. The result is an HTML code.
When I click the link, some browsers open the HTML code in a new tab, while others offer to download it as a .print file, depending on their specific settings I think. Opening this .print file shows the same HTML page as opening it directly, but locally instead of from the server.
How can I force it to always open in a new tab?
I think it might be a mimetype issue. If it is, which mimetype can I use to tell the browser to open the HTML code directly? I am currently using text/html as mimetype.
EDIT: some more info
To give some more insight, adapting from a comment of mine below:
I do not create the link myself. The link is provided by Trac, the bug tracking software the plugin is for, and what I do is implement the method that creates the HTML code and let it return the HTML code along with the mimetype. Trac then returns the HTML code either as a file, or as a new tab, when clicking on that content conversion link. What I am searching for is a possibility to specify in the HTML code or mimetype that it gets opened in a new tab directly.
Maybe there is some kind of mimetype specifying the (HTML) text as an HTML web document instead of HTML file (if that distinction even exists).
Or an HTML/XML header or doctype specifying whether it gets downloaded or opened by a browser. I think the browser need to get that information from somewhere.
Or maybe there is an option to set in Trac.
I hope these ideas of mine about what could exist can help those of you who are versed with either or some of these to find a solution. I could not find a solution through my research yet.
If you have a link that "directly" opens (not in a new tab) and you want it to open a new tab, one way of doing it is
This will create a blank page, then paste the link there automagically and thus you will have a new tab with the desired page.
Is there any way I can find out what the latest file Selenium downloaded was, and from where (what URL) it was downloaded?
I am fetching files from a large number of sites (that I do not control) by clicking on elements, and my problem is that I do not know how the files are downloaded. Sometimes it is just an <a> element, sometimes there is a Javascript event attached to some element, or form (not always obvious from inspection), and so on, and so on.
So I though the easiest would be to just do my clicks, and then check what landed in the download folder. But then I have no idea where that file came from, and I also need to store the url.
For files that can be displayed inline, I can, of course, open them in the browser and get the driver.current_url. This is very convenient for file formats where it actually works, so if there is a way to force e.g. Firefox or Chrome to open all files inline, that would also be an option. (I am aware of one such extension. That extension, however, requires some user interaction in a OS file dialogue window, and that seems like overkill here)
Possible solutions
Firefox: Read moz_downloads from downloads.sqlite, in the FF SQLite DB
Chrome: Read the corresponding SQLite db for Chrome/ium
Write browser extensions that modifies the mimetype of visited pages, so that all files are opened as plain in the browser, and the URLs can be accessed from there.
How I understanding selenium it only insert js to page, that mean that you can interact only with web page but not with browser futures.
But you can do like in this post How to access Google Chrome browser history programmatically on local machine if that files are in download history you can find them there.
Is there a way for an HTML file or other format that when clicked, will open the default browser and navigate to a specified http:// web page, NOT a local file:// ?
<script>
location.href = 'www.someUrl.com'
</script>
Just create an html file that contains something like the above. When you click it you will be redirected.
At least for an HTML file, no. When you click on an HTML file, your computer will open it in your default web browser, and the URL at the top will will be a file:// as that's the location of your file. You can, however, include some JavaScript to redirect people.
<script>window.location = "https://www.google.com";</script>
That way people will open the local file, but they will be automatically redirected to Google.
Yes, a shortcut.
Create shotcut and type your browser application url and add link.
Example like this:
"C:\Program Files\Firefox\firefox.exe" "http://www.google.com"
Do you mean if there is a way to set your HTML files to a default web browser, so that when you double-click them, they'll open up in....lets say for example (chrome.exe, firefox, opera, etc etc...)? If so, I recommend you right click the HTML file and navigate to "open with", and choose the web browsing program you want to use.
If you really want to take the easy route. Download notepand++ text editor(notepad-plus-plus.org).
Here's a picture of how to run HTML file in notepad++ in the browser:
http://i.stack.imgur.com/Yuynt.png