Open .htm attachment in a new tab

Hello,

How I make an attached html file (.htm) to open directly in the browser?

For example, let’s say I have 2 attachments: image1.jpg and page1.htm. Then, in my XWiki page I have these 2 links:

[[image>>attach:image1.jpg||rel=“noopener noreferrer” target=“_blank”]]

[[htm page>>attach:page1.htm||rel=“noopener noreferrer” target=“_blank”]]

When I click on the first link, it opens in a new tab with an address: https://…/xwiki/bin/download/…path…/WebHome/image1.jpg

However, when I click on the second one, it first downloads the page.htm file to my local PC and then loads it in the browser with: file:///C:/Users/user/Downloads/page1.htm

Is there a way to open the second link directly from XWiki as well? Thanks!

I think this is a behavior of your browser. You should research in this direction IMO.

To debug the issue, you can easily check the HTML that XWiki generates by viewing the HTML source in your browser.

This is for security reasons (possibility of XSS). When the user in XWiki who uploads the file has programming rights, the HTML file should also open in the browser.