# Show HTML email in desktop instead of opening in browser

**URL:** <https://forum.delta.chat/t/show-html-email-in-desktop-instead-of-opening-in-browser/2386>\
**Category:** Feature Proposal\
**Tags:** desktop\
**Created:** [January 8, 2023, 5:55pm UTC](https://forum.delta.chat/t/show-html-email-in-desktop-instead-of-opening-in-browser/2386 "2023-01-08T17:55:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon](https://forum.delta.chat/user_avatar/forum.delta.chat/simon/32/287_2.png) [@Simon](https://forum.delta.chat/u/Simon)\
**Post date:** [January 8, 2023, 5:55pm UTC](https://forum.delta.chat/t/show-html-email-in-desktop-instead-of-opening-in-browser/2386/1 "2023-01-08T17:55:38Z")

</div>

## Goal:

Open the html email in a new dialog/window where user can press a button to allow external images / css.

Like on mobile:

- Do NOT run javascript
- Do NOT load remote content unless user allowed it.
- Open Links in browser and NOT in the webview the email is displayed in.

## How?

### No javascript:

- `<iframe sandbox="">` disables javascript (unless you enable `allow-scripts` explicitly)
- can be turned off in the [BrowserView | Electron](https://www.electronjs.org/docs/latest/api/browser-view) in electron in webContents

### Block Remote content:

Universal ideas:

- [`csp` attribute on iframe](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/csp) - should work, but not on safari/webkit because it’s experimental, so would only work under windows in tauri. so no option for tauri.
- load from origin where we can set CSP via header - should [work anywhere](https://caniuse.com/contentsecuritypolicy) where we can do it.

Electron ideas:

- Browser view with csp from custom scheme, similar to what we already have for the webxdc window.

### Catch navigation

Universal ideas:

- there does not seem a good way to do this, maybe some load event on the iframe, but might be difficult to do something, because we disabled js already, also the unload event fires after it’s loaded, which is the opposite of what we want here.

Electron ideas:

- [`event-will-navigate`](https://www.electronjs.org/docs/latest/api/web-contents#event-will-navigate) on webContents on Browserview

## Other ideas:

we could sanitize the html before displaying it (for example with [https://lib.rs/crates/ammonia](https://lib.rs/crates/ammonia)), then we don’t need to worry about scripts and other XSS and can inject our own javascript to redirect the links.  
We could even remove remote content that way but it’s probably more complicated.

---

<div class="post-metadata">

**Author:** ![Simon](https://forum.delta.chat/user_avatar/forum.delta.chat/simon/32/287_2.png) [@Simon](https://forum.delta.chat/u/Simon)\
**Post date:** [April 9, 2023, 8:06pm UTC](https://forum.delta.chat/t/show-html-email-in-desktop-instead-of-opening-in-browser/2386/2 "2023-04-09T20:06:10Z")

</div>

desktop 1.36 has this.

> <https://github.com/deltachat/deltachat-desktop/pull/3110>
>
> Open HTML message in dedicated window instead of inside of the browser.
> 
> | no …remote content | confirmation| with remote content|
> |-------------------|--------------|----------------|
> | \<img width="646" alt="Bildschirmfoto 2023-02-03 um 22 12 31" src="https://user-images.githubusercontent.com/18725968/216712232-f1ed4772-29d6-427b-856b-00f1b6e51969.png"\> |\<img width="646" alt="Bildschirmfoto 2023-02-03 um 22 12 37" src="https://user-images.githubusercontent.com/18725968/216712293-7fea367d-d3ec-408d-bcac-c31d1e8e37ef.png"\>|\<img width="646" alt="Bildschirmfoto 2023-02-03 um 22 12 44" src="https://user-images.githubusercontent.com/18725968/216712321-0f17005c-68cf-4e2b-8f92-79693ed7ba77.png"\>|
> 
> 
> this will also close #3056,
> because with this pr, there is no "open in browser" anymore.
> 
> \## TODO:
> \- \[X\] use translation system and use the string bjoern mentioned.
> \- \[X\] checkbox for remote content with dialog on click
> \- \[X\] better design of the header
> \- \[x\] respect theming (should we keep white as default background for the email though?)
> \- \[x\] always handle mailto links in deltachat

---

<div class="post-metadata">

**Author:** ![r10s](https://forum.delta.chat/user_avatar/forum.delta.chat/r10s/32/1513_2.png) [@r10s](https://forum.delta.chat/u/r10s)\
**Post date:** [October 6, 2026, 3:11pm UTC](https://forum.delta.chat/t/show-html-email-in-desktop-instead-of-opening-in-browser/2386/3 "2026-10-06T15:11:43Z")

</div>


