Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to open html file inline in AEM assets than downloading it?

Avatar

Adobe Champion

I have a html file which is residing in DAM which is the default page to be displayed from Akamai incase of an error. We don't have sites license and hence this html residing in DAM.

I have the html file now available in DAM like an asset. But when I try to access it through the dispatcher URL, it gets downloaded as a file than opening the page inline in the browser. How can i fix this issue and open that inline instead of downloading?

I tried https://helpx.adobe.com/mt/experience-manager/kb/HTML-file-stored-in-CRX-does-not-open-in-Browser-in... and https://stackoverflow.com/questions/42447453/is-there-a-way-to-upload-html-pages-into-aem-dam 

15 Replies

Avatar

Employee

@P_V_Nair Are you able to view the HTML file in the Browser when you access the AEM instance directly (without the Dispatcher)?

Have you configured the headers section (added "Content-Disposition") in the Dispatcher Configuration as per [1]?

[1]  https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-c...

Avatar

Adobe Champion

@muskaanchandwani I have verified direct publish instance and there too it is getting downloaded  than opening inline. [1] is already covered in our dispatcher, I just verified. So , i think we need to fix this first in direct publish.

Avatar

Level 4

I don't think you can render the asset directly. You would need a renderer that can use this asset URL to render.

Avatar

Adobe Champion

@digarg31  Do you mean to say a renderer component using Sites? We don't have sites license and not planning to create any page component to do this. I have seen blogs as in the links above seeing users have done this by opening html pages from assets inline. But that same configuration change is not working for me.

Avatar

Community Advisor

Hi @P_V_Nair Since AEM DAM is an asset container, html can be uploaded and used as an asset in other html, but html cannot be opened directly from DAM.

Avatar

Adobe Champion

@Nitin_laad  Thank you for your reply. I have seen in some posts - Is there a way to upload html pages into AEM DAM - Stack Overflow

and

HTML file stored in CRX does not open in Browser, instead, it is getting downloaded | AEM (adobe.com...

that this is possible by changing the configuration,  Dam Safe Binary Filter(com.day.cq.dam.core.impl.servlet.DamContentDispositionFilter . 

But , I tried the same in 6.5 and it doesn't work. 

Avatar

Community Advisor

Hi @P_V_Nair Before replying, I had tried the given solution and it did not work for me either. Before implementing, you should review the following references - 

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/assets/assets-cloud...

Nitin_laad_0-1662476058478.png

if you still want to go with your use case you can try it at dispatcher level. 

ie-

<LocationMatch "\.(?i:html)$">
  ForceType text/html
  Header set Content-Disposition inline
</LocationMatch>

I would recommend you to raise a ticket to Adobe and get it confirm before going with this implementation. 

 

Avatar

Adobe Champion

Thanks @Nitin_laad  We are not into cloud as a service yet. We are on managed services. I can definitely check with Adobe before we go for it.

Can you also help me locate the dispatcher config file should we incorporate this change? Is it the farm file?

Avatar

Adobe Champion

@Nitin_laad I tried hitting direct publish url instead of dispatcher URL and there too it gets downloaded instead of opening inline.

Avatar

Adobe Champion

@Nitin_laad  I tried this as well in our dispatcher vhost file as below by adding the location match and unfortunately, it still did not work. The html still gets downloaded than opening inline.

P_V_Nair_0-1662567297085.png

 

Avatar

Level 2

Hello @P_V_Nair 

 

I have same problem, I want to load public image inline and always is downloaded. Have you resolved this problem?

Regards.

Avatar

Adobe Champion

@ana_belen_cano_  Unfortunately no. None of the recommendations worked for me and at last we changed the solution to create a simple page component and create a error page in sites to add the same html in there.

Avatar

Level 2

Hi, we have resolved problem with this configuration on dispatcher:

 

<LocationMatch "^/content/dam/.*\.(?i:jpe?g|gif|js|mov|mp4|png|svg|txt|zip|ico|webp|pdf)$">
Header unset "Content-Disposition"
Header set Content-Disposition inline
</LocationMatch>

 

Our content DAM is now loaded on browser. 

 

Regards.