Can't download file using HTML5 download attribute - html

I'm trying to create a download link the way it always worked for me. But now it keeps redirecting me to Google Docs – I've never experienced that before, this should be a straight-forward task to do, so it quite shocked me.
I use the HTML5 download attribute:
<a href="../files/uploads/myfile.docx" download>myfile.docx</a>
But I always end up redirected to Google Docs. I also opened the Chrome dev console and noticed that after I click on the link, it changes the href to Google Docs. I have no clue why.
The path should be alright, I can't figure out the problem. What shall I do?

The download attribute only works for same-originl URLs. So if the href is not the same origin as the site, it won't work. In other words, you can only download files that belongs to that website. This attribute follows the same rules outline in the same-origin policy

Related

OneNote to open link in Chrome without Chrome being default

I have a very simple question I could not find answer for myself: I want links in OneNote to open in Chrome.
Note that the default browser is IE and I cannot change it (not admin etc).
Tried: "chrome_path url" - didn't work. Everything I could think about didn't work.
Please provide explicit solution so that link from within OneNote opens in Chrome rather than in IE.
To note, there are multiple links, so batch file won't do in this case.
Thank you in advance!
I had a little go with testing some ideas that I had though I'm very new to OneNote. It's easy enough to open Chrome from a hyperlink:
Select text to link
Add link
Select the file icon and navigate to chrome.exe. In my instance - C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
I believe you cannot pass arguments to the exe as it is considered a security issue. This certainly used to be the case and I'm not sure if they have modified their thinking since. The only way I can think of is to create a batch file which includes your ideal website and link to the batch file:
"start chrome http://www.youtube.com"
I found two ways to do it, though neither is the perfect:
There is a 3rd party OneNote add-on which adds more browsers in the right-click menu. Though it is not free and maybe can't be installed on restricted computers.
It works only on OneNote docs which are saved onto Onedrive. Open the OneNote page which has the links right in the Chrome, not in the desktop app. Then any links you click will open in the same browser. You can get the address of the OneNote page by clicking on 'Copy Link to Page' in OneNote app, then paste it to a notepad. Copy the first url to Chrome's address bar.
For those who has admin right, this problem can be solved by following Make Chrome your default browser. It is set at machine level, not onenote level.

index.html file is not reading main.css file for only chrome (desktop)

My website is hosted by 000webhostapp.com. It is working in all browsers (Moz, Opera and mobile) except desktop chrome. There is no error in W3C validator and all path and links are correctly written. What maybe a reason?
in Chrome desktop
DT(F12) console screen
The culprit here is AdBlock. More precisely, EasyList filter list that is applied to AdBlock's filter sets by default.
There's a following rule inside that set which says: Block any resource where URL matches to /adx, but not for domains adx.uk.com or adx.wowfi.com.
/adx.$domain=~adx.uk.com|~adx.wowfi.com
In your case it matches a part of your domain name: http://adx.000webhostapp.com/css/normalize.css
You can find every blocked resource on AdBlock tab in your browser's Developer Tools.
How to solve this?
The best way to solve this is to contact EasyList authors and inform them about incorrectly blocked content. According to their website, the preferred way is to write on their forum (registration is not required).
Another way is to serve every resource (styles, scripts, images) from different domain that will not get caught up in the filter.
Yet another way, tho not recommended, is to ignore this issue or entirely change your domain name.
I looked into it and it seems the problem is adblock, I tried disabling my adblock on chrome and it worked just fine so maybe look into why adblock is stopping you from loading your css or just put in something that tells the user to disable the adblock.
More information here: https://www.keycdn.com/support/how-to-solve-err-blocked-by-client/

How to make chrome download instead of try to display a file

I'm trying to access a document template (.dot) that's linked from a company portal, using chrome. When I click on the link, the browser shows me a bunch of garbage. Is there a setting to force chrome to download this type of file and open it in word?
Example of garbage:
For HTML5:
<a href='file.dot' download>Click here to download</a>
'Download' attribute documentation can be read at:
http://www.w3schools.com/tags/att_a_download.asp
Supported since chrome 14.0.
EDIT: However this is controlled by the site. As for client-side settings, i think only changing the .DOT extension to match Word files in Windows, and perhaps even that won't work if chrome uses its own list.
In any case, you can right-click and "Save file as...", but yes, it's annoying.

Linking to a Local Page from a Local Sever

I've previously explained that I was trying to link a ejs page to a jade-based app. Then after many failed attempts I tried to convert that page to Jade and still ended up with a truckload of errors. Finally, I thought about simply putting a HTML Link that would redirect me to that ejs page on click.
What I fail to understand though, is why Firefox has no problems displaying the page when I directly put its path in the browser:
file:///home/ghanem/Documents/Project/views/account/el/el.ejs
But when I try to access it from my app through a simple code, it doesn't redirect me to the same very page:
My Stubborn Link
I should also point out that I've already set security.fileuri.strict_origin_policy to false in Firefox.
What I fail to understand though, is why Firefox has no problems displaying the page when I directly put its path in the browser
Because it trusts you
But when I try to access it from my app through a simple code
Your app is "just another website" as far as Firefox is concerned. It doesn't trust it.
I should also point out that I've already set security.fileuri.strict_origin_policy to false in Firefox.
That lets XMLHttpRequest access file:// URLs providing the document it is running in was loaded from a file:// URL.
See mozillaZine: Links to local pages do not work.
user_pref("capability.policy.policynames", "localfilelinks");
user_pref("capability.policy.localfilelinks.sites", "http://localhost:7896");
user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");

HTMl anchor link to local file

I'm testing a locally run web app and am trying to use anchor tags to link to log file output on my C: drive. The href value that's generated for the anchor is in the standard URI format "file:///C:/outbox/myLog.txt". But, when I try to click the anchor, the link doesn't go anywhere, I have to right-click and copy the link into the address bar or to a new tab. I'm not sure why copying the link works whereas the link itself isn't clickable. Any help is appreciated.
Is this the case on different browsers? What is your browser / OS? We've seen this as a fault on Windows XP on both IE and Firefox browsers and may be nothing to do with your code
From my understanding, you can't link to file:/// from an HTML doc for security reasons. You might want to try this chrome extension.