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

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

New Here ,
Jul 10, 2022 Jul 10, 2022

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

 

TOPICS
Code , How to
568
Translate
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
Translate
Community Expert ,
Jul 10, 2022 Jul 10, 2022

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

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
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

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.

Translate
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

I'm surprised too

Translate
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

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

Translate
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
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
Translate
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