• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Re: Force link to download file [Branched from 2018 topic.]

New Here ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

Can you please share the code for me? I can't understand very well, I'm a beginner. :brazil:

 

TOPICS
Code , How to

Views

189

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 10, 2022 Jul 10, 2022

Votes

Translate

Translate
Community Expert ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

See here https://www.w3schools.com/TAGS/att_a_download.asp

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

Supprised no one picked up on what Ben posted.
Download is one attribute you just add to HTML so you do not need to do anything else.
Key note though is that different browsers do read this differently. If you have a dynamically generated file for example Chrome does have issue triggering this properly so it is recomended that rather than just adding "download" if you do come across issues to specify the file name download="myfile" as per the docs Ben kindly linked.

Less is more, this is defiantly less.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

I'm surprised too

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2022 Jul 10, 2022

Copy link to clipboard

Copied

it worked in your example, but i replicated it in my html using a mobile editor and it didn't work, any tips please?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

LATEST

 

@Alok25195406pb2h,

It failed because the code I posted in 2018 was intended for the .htaccess file, not the HTML file.   .htaccess is a server configuration file, not a web page.

 

Use @BenPleysier's answer above.

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines