Jump to content

Is it possible to have a download link that downloads an image instead of opens a page?

Recommended Posts

I would like an image download to start in the background when a button is clicked, as is the norm. Instead squarespace opens a page, requiring an additional right-click step. I can't seem to find how to prevent this.

 

When using a link, you have the option of page, file,  etc. so I don't understand why when choosing a file, it opens a page regardless.

 

I am using a code block, but this seems to be the case whatever method i use, such as buttons, forms etc.

my current html code is:

<a href="/s/DM042_Wallpaper_Phone.jpg" download="jonpxl_wallpaper_DM042_phone" target="_blank" class="button">WALLPAPER</a>

 

Link to comment
2 hours ago, JonJonJon said:

I would like an image download to start in the background when a button is clicked, as is the norm. Instead squarespace opens a page, requiring an additional right-click step. I can't seem to find how to prevent this.

 

When using a link, you have the option of page, file,  etc. so I don't understand why when choosing a file, it opens a page regardless.

 

I am using a code block, but this seems to be the case whatever method i use, such as buttons, forms etc.

my current html code is:

<a href="/s/DM042_Wallpaper_Phone.jpg" download="jonpxl_wallpaper_DM042_phone" target="_blank" class="button">WALLPAPER</a>

 

You mean to trigger download when button click?

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
  • 2 weeks later...
  • 10 months later...
  • 1 year later...

Usually we can use download attribute to trigger download file from a link, but Squarespace images are stored on their CDN, which has different domain (cross-origin) from user website, therefore the download attribute may not work as intended  Chrome deprecations and removals announcement

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.