How to add download .app file from html button - html

I cannot figure this one out.
Here's my code.
<a class="button button-primary" href="NewApp.app" download="NewApp"><i class="fa fa-download" style="margin-top: 2px;"></i> Download</a>
The app is called NewApp.
The NewApp.app file is in the same as index.html.
This button just downloads a random file 'NewApp.html' which doesn't exist.
How do I fix this?

Have you tried, instead of download="NewApp", just download. In HTML, I believe, to download a file, you must do the following:
<a href="foo.app" class="button button-primary" download>Download the app!</a>
It will automatically download the file that the href attribute is pointing towards. I hope this helps.

Related

HTML: Not downloading file on click

I wish to download excel file on click/trigger:
<a href="/download/test.xlsx" download>
<button id = 'download' type="button" class="btn btn-outline-info" onclick="">
Download File
</button>
</a>
This while clicking is failing as it is trying to go to "file:///C:/download/test.xlsx".
What is wrong here?
You code is correct except the file file path.
You need to have the file in the same folder in which you have your html file.
So if the files name is some_text.txt which is in the same folder, then use the following code:
<a href="some_text.txt" download>
<button id = 'download' type="button" onclick="">
Download File
</button>
</a>
It worked for me, it will also work for you.
You could also try replacing it with images also.
For more check this link: https://www.w3schools.com/howto/howto_html_download_link.asp

Not Downloading Files in HTML

I am trying to create a download link to a file I've created but it is not working. I've tried it without the <img> and without the download specification but nothing seems to work!
<a href="Downloadable File.txt" download="file">
<img src="downloadbutton.png">
</a>
All it does is redirect me to a page without the file downloading like it's supposed to, how do I fix this?
Try this and make sure that your file exists on the server or at least at the right path.
<a href="path/to/your/download/file" download="filename">
<img src="downloadbutton.png">
</a>
It is not download="file".
It should be download only.
And please check your href. It should be some path to your file.
<a href="path/to/your/file.txt" download>
<img src="downloadbutton.png">
</a>

Unexpected not workable download button

I have the following code based others tutorials (look at the picture):
When I run the code through the browser, the button is appeared but when I click on it the pdf does not downloaded (or appeared to other html page).I have checked if there is any problem with the file link but when I run it through browser is appeared to browser properly. I must note that this code is included to php file ( for example file.php).CODE
HTML:
<button class="etc etc">
<i class="fa fa-download"></i>Katabaste Odygies
</button>
Try changing your anchor tag to look like this:
<button class="etc etc">
<a href="itdb/a.pdf">
<i class="fa fa-download"></i>Katabaste Odygies
</a>
</button>
When people click the <i> tag, it is not inside the <a> so the download is not being triggered.
Also, you are referencing the file incorrectly for a web server.

Download file from local path / server path using html tag <a> (newbie)

I am trying to download a file on image click using following code -
<a href="file:///D:\dir\a.pdf" target="_self" download>
<i class="glyphicon glyphicon-download-alt" id="download"> </i>
</a>
If I add any html url, it's working fine but here it dosen't do anything. Please help
[EDIT]
I have even tried -
<a href="file:///D:/dir/a.pdf" target="_self" download>
<i class="glyphicon glyphicon-download-alt" id="download"> </i>
</a>
Using file:///... will only work if your HTML page is also local (opened via file:/// also). If that is not the case look at: http://www.websina.com/bugzero/kb/browser-file-url.html

Returning back to an HTML page

I have two html files called home.html and options.html. In the options.html, after I clicked the submit button, I am now in the cgi-bin directory of my webserver. What should be the format of my anchor tag so I can go back to the home.html page?
This is the code:
<a href='localhost/cgi-bin'>GO BACK</a>
The error I encounter is:
The requested URL /cgi-bin/localhost/home.html was not found on this server.
Not sure I have understood your issue, but this probably could work:
<a href='/home.html'>GO BACK</a>
you can use:
<a href='javascript:history.back(-1)'>GO BACK</a>
if both pages are in same directory you can do something like this
GO BACK
else give absolute path
<a href="http://webserver/cgi-bin/home.html" >GO BACK</a>
post complete directory structure of both files so that we can find a relative path.
I found the answer to be:
GO BACK
use
<a href='localhost/cgi-bin/home.html'>GO BACK</a>