As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hi,
I have uploaded html file in documentlibrary.
When I use View in Browser , it is ignoring html style and display plain text only.
it is loading in browser so It should display like normal html file we are opening in browser with style.
Unfortunately, Alfresco Share has a very aggressive "HTML stripping" functionality to prevent malicious content / hijacking in HTML files, which applies to the "view in browser" feature for HTML files. Essentially, the style markup is transparently removed from the HTML when it is being loaded from the backend, resulting in the plain-text-like display. In one of my modules I circumvent that URL-based handling by mapping a default functionality to a custom URL, and then reconfigure the "view in browser" action in a customer system to use that non-processed URL instead of the default.
Please help to achieve that scenario.
How Can I change code?
Is it proper way to override bean?
Hi Axel! thanks for the input.
I am having the same issue. Could you please point me on the right direction on how to avoid this filters in order for the html files to load correctly?
Thanks!
David
i hope can fix the issue please refer to the WebLogic training tutorial.
I do not advocate changing Alfresco code for this. I primarily advocate mapping the download web script to a different URL (similar to how I do it via a custom web script mapped to a bean extended from the same parent ), and then reconfiguring the view-content action to use a different href that maps to the custom web script (the default viewUrl is calculated here using https://github.com/Alfresco/share/blob/master/share-services/src/main/resources/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/item.lib.ftl#L72 ). E.g. for my web script I would have to configure the following href pattern:
/share/proxy/alfresco/acosix/api/utility/node/slingshot/{node.nodeRef.storeType}/{node.nodeRef.storeId}/{node.nodeRef.id}
If you wanted to eliminate the /share/proxy/alfresco/ prefix and use constants with deployment specific values (technically both "share" and "alfresco" in the prefix could be different in some deployments, but 99.99% stick to the default, and most people probably don't know how it could be changed to begin with), you would have to write a JavaScript based action, register and use it as documented on docs.alfresco.com.
I did the same thing but I am getting error like
Step 1 : this path I have created given .xml file with same content for test.
Step 2: Created bean in webscript-context.xml
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <bean id="webscript.de.acosix.acosix-utility.slingshot-content.get" parent="webscript.default" /> </beans>
Step 3 : Create javascript base custom action and opening url.
(function() { YAHOO.Bubbling .fire("registerAction", { actionName : "viewInBrowser", fn : function viewInBrowser(file) { console.log(file); var contentUrl = Alfresco.constants.PROXY_URI+"acosix/api/utility/node/slingshot/"+file.nodeRef.replace(":/","")+"/"+file.fileName; window.open(contentUrl); } }); })();
Do I need to override all the bean of this file?