How to force chrome to download an url with custom filename - google-chrome

Tried this:
Download Your Foo
Chrome unfortunatelly completely ignores the download attribute.
What can I do? Ideally to make it cross-browser...
Thanks

Have you tested this on any other web browsers.
According to w3schools here, it is an HTML5 attribute and internet explorer and safari do not support it. So, if you are looking for cross-browser, this probably isn't the best solution.
Also the link you have composed is wrong, if you downloaded google.com it points to index.html(I checked) .
I tried <a href="http://www.google.com" download>Here</a> and opened it in the latest chrome and it downloaded index.html. So if you need google chrome compatibility do a download attribute with "[your choice].html".
If you would like cross-browser compatibility I suggest you use php to change the headers then echo google's source. If you are unfamiliar with php go to
here

Related

Replace redirect from Microsft Edge to Google Chrome in HTML

in this piece of HTML code
PARTECIPA
the opening of the website in the Microsoft Edge browser is indicated if installed on the device.
Can anyone help me? I would like the site to open in Google Chrome and not in Edge.
How should I edit this HTML?
To open the link using the Chrome browser instead of Microsoft Edge, you can change the value of href attribute like this: PARTECIPA. Assuming that Chrome browser is installed, that should open the Chrome browser.
Problem:
If Edge is not installed on the device (mob, desk or tab) it doesn't
work
In this case, it's best to simply use a standard URL without specifying a specific browser, like this. PARTECIPA. In addition, the "googlechrome:" protocol is not a standardized protocol and probably may not work in all devices. So, you can use a standardized URL like the code snippet I posted above and let the users device choose.
Do you know if instead of chrome I can specify "default browser"
Example PARTECIPA or
something similar?
There is no standard protocol for specifying the default browser. So, best approach is to simply use a standard URL without specifying a specific browser. But if you really want to use special web protocols inside hypertext links to force web pages or files to open with particular browsers on Windows or iOS, place browser-name before the hypertext reference link.
Check this:
Open in Google Chrome
Open in Microsoft Edge
Open in Mozilla Firefox
Open in Apple Safari
Open in Opera
This function does not work!
A similar example is for IOS, which works in the following way
Example :
PARTECIPA
Google has official documentation on the Chrome iOS app’s URI scheme on its developer website.
Simply replace http with googlechrome and https with googlechromes. This means:
http://www.google.com/ becomes googlechrome://www.google.com/
https://apple.stackexchange.com/ becomes googlechromes://apple.stackexchange.com/
Previously, it supported an x-callback-url of googlechrome-x-callback://. This allowed the calling app to indicate its name and URI scheme to Chrome, which would show a back button in the address bar that closes the tab and invokes the specified URI. This feature was removed a few years ago when iOS 9 added the “Back to …” button in the status bar (but the URI scheme still works).

Download attribute not working in safari

I am using a download attribute in my link:
<a style="color:white" download="myimage" href="images/myimage.jpg">Download image</a>
It is working very well in almost all browsers. This means, if I click on the link the image is automatically downloaded. I tested it in safari 10.1.2 on my mac and it is working fine.
But on my friends mac who is working with safari 10.0.3 it is not working. He is saying that the image is only opening in a new window but not downloading.
Why is this happening and what can I do to make it work anywhere?
According to https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_1.html, it was added in Safari 10.1:
HTML5 Download Attribute
The download attribute for anchor elements
indicates that the link target is a download link that downloads a
file, instead of a navigational link. When you click a a link with the
download attribute, the target is downloaded as a file. Optionally,
the value of the download attribute provides the suggested name of the
file.
It doesn't seem to be available in iOS Safari 11.1 though from my own testing, which has me a bit confused. I'd expect them to be equal in standards support, based on their similar version numbering.
try this code:
var element = document.createElement('a');
var clearUrl = base64.replace(/^data:image\/\w+;base64,/, '');
// element.setAttribute('href', 'data:attachment/image' + base64);
element.setAttribute('href', 'data:application/octet-stream;base64,' + encodeURIComponent(clearUrl));
element.setAttribute('download', 'filename.jpg');
document.body.appendChild(element);
element.click();
document.body.removeChild(element)
This is work for me in safari version 10.0.3
Please take a look at https://www.w3schools.com/TagS/tag_a.asp
Scroll down to attributes, and you will see that the DOWNLOAD attribute is only supported by HTML5, which, as it seems, your friend's version of Safari does not support. I recommend updating the program.
Alternatively, you can right-click on the image, then click Save As..., then download it that way.
#Jarla

is there anyway to force a link to open up in IE, even if not the default browser

we have a website with links to a sharepoint. These features in sharepoint only work in IE so i dont want to open up firefox or chrome if that is the default browser. Is there anyway to have a
My Link
force open up in internet explorer ?
You can use javascript to inject the link in your HTML code if the client is IE, and maybe show a warning message if the browser isn't IE. Anyway you can't tell any browser to open a link using another browser.
No, definitely not.
For Firefox users, the best thing that comes to mind is to have them install the IE tab. It allows the opening of pages inside Firefox but using the IE engine - but also requires user action.
If this is run in a windows environment, you could use a PHP script to open Internet Explorer through PHPs support for COM objects.
If you are interested I can provide the script to do this.

Launch file:// from Firefox or Chrome

I am looking for a way to launch a file located on our local file network for use via our local intranet using Firefox or Chrome.
The link works well in IE:
View Report
but in Firefox it shows:
View Report
is there a way to get the link to render properly?...Just a simple click from a href tag.
For Chrome, a new extension was just posted today! It's called LocalLinks and it replicates the functionality of the locallink add-on for Firefox! You'll find it on the Google Extensions page, or you can get to it directly here:
https://chrome.google.com/extensions/detail/jllpkdkcdjndhggodimiphkghogcpida
Enjoy!
This is not enabled in firefox for security reasons (remember that most computers have files and applications of a sensitive nature located in similar locations, like C:\System\Windows)
you can try adding this to the user.js file for any user that needs to be able to access these links:
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "file:///[[PUT SERVER NAME HERE]]";);
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
Just remember that this is a security risk.
Firefox seems to want file://///Start/Of/My/Network/file.xlsx
Chrome and IE handles that too.
file://Start/Of/My/Network/file.xlsx appears to work in Chrome as well, sometimes firefox hics up on it..
There is the LocalLink add-on for firefox. It uses a context menu though...
Use IE tab (available for Chrome and Firefox) and set that to handle all links of the form file:/// by adding an autourls entry like this:
r/file:///.*
Technically this isn't opening the file in the original browser, but it gives you all the windows explorer integration you'd expect from whatever IE version you've got installed when dealing with local file links. I would advise against doing this except in cases when the browser isn't being used to access the web - e.g. for viewing internal wiki or intranet pages, due to the obvious security risk.

Cross-browser link to file on local system

I would like to make a link from a web page to a file on a local filesystem and make it work in all browsers (or at least in Internet Explorer, Firefox and Chrome).
For example, the following works in Internet Explorer:
Info here
but not in Firefox and Chrome.
Is there a way to make a link that works in all browsers?
Or a way to use javascript to detect which browser it is and then display the appropriate link based on the filename?
Links to local files on pages that were retrieved via HTTP(S) are deliberately disabled in Mozilla/Firefox, because they can be a security risk, and have been used in attacks in the past.
You can override this behaviour, however. For details, see this article in MozillaZine.
try prefixing your url with file:///