Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Prevent document from auto downloading in asset share commons

Avatar

Level 6

I want to prevent the auto download of documents in asset share commons. Is there a config to do this?

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi @Shaheena_Sheikh ,

To my knowledge ASC provides control over how assets are shared and accessed, but the auto-download behavior might not have a direct configuration setting. However, you can try to manage this behavior indirectly using
1. Access Controls: By allowing group/user read only access at folder level or asset level.

2. JavaScript-Based Solution: Utilize JavaScript to intercept the click event on the asset links and provide a custom behavior like

document.addEventListener('DOMContentLoaded', function() {
  const assetLinks = document.querySelectorAll('.asc-asset-link'); // Example selector for ASC asset links

  assetLinks.forEach(link => {
    link.addEventListener('click', function(event) {
      event.preventDefault(); // Prevent the default behavior (e.g., download)
      // You can implement custom logic here, like displaying a confirmation modal or opening the asset in a new tab/window.
    });
  });
});


Let me know if it works

View solution in original post

3 Replies

Avatar

Level 9

Hi @Shaheena_Sheikh : Please refer asset-share-commons documentation for enabling/disabling direct download option. Also, please check if it is supported for the version you are using.

https://opensource.adobe.com/asset-share-commons/pages/actions/download/#dialog--behavior

 

Kamal_Kishor_0-1704362192604.png

 

Avatar

Level 9

Hi @Shaheena_Sheikh: Did you get a chance to try this suggestion as well. Please let me know if this helps in some way.
Thanks.

Avatar

Correct answer by
Level 7

Hi @Shaheena_Sheikh ,

To my knowledge ASC provides control over how assets are shared and accessed, but the auto-download behavior might not have a direct configuration setting. However, you can try to manage this behavior indirectly using
1. Access Controls: By allowing group/user read only access at folder level or asset level.

2. JavaScript-Based Solution: Utilize JavaScript to intercept the click event on the asset links and provide a custom behavior like

document.addEventListener('DOMContentLoaded', function() {
  const assetLinks = document.querySelectorAll('.asc-asset-link'); // Example selector for ASC asset links

  assetLinks.forEach(link => {
    link.addEventListener('click', function(event) {
      event.preventDefault(); // Prevent the default behavior (e.g., download)
      // You can implement custom logic here, like displaying a confirmation modal or opening the asset in a new tab/window.
    });
  });
});


Let me know if it works