Discussion:
[Caja] Allow full display and interaction with Html Emails
felbus
2017-04-14 09:48:09 UTC
Permalink
Hi,

tldr; how do I load an html email in to a div with caja, allowing the
loading of images and clickable links

---

Im just starting to use caja, the API links are down, so am not sure
whether this is the default behaviour.

I am loading an html email in to a div like this:

caja.load(document.getElementById('messagebox'), undefined, function(frame) {
frame.code(contentUrl, 'text/html').run();
});


When it is rendered on the page, the images and hrefs are all stripped out.
So you cannot see images or click links.

I am guessing this is the default behaviour to prevent attacks.

My question is how do I allow these to be loaded so that the page is
displayed as intended?

Thanks
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-caja-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Kevin Reid' via Google Caja Discuss
2017-04-14 17:05:37 UTC
Permalink
Post by felbus
caja.load(document.getElementById('messagebox'), undefined, function(frame) {
frame.code(contentUrl, 'text/html').run();
});
When it is rendered on the page, the images and hrefs are all stripped
out. So you cannot see images or click links.
I am guessing this is the default behaviour to prevent attacks.
My question is how do I allow these to be loaded so that the page is
displayed as intended?
You need to specify the URI policy instead of undefined.

The simplest policy is caja.policy.net.ALL which will allow links and
images for all sites.
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-caja-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
felbus
2017-04-15 07:41:26 UTC
Permalink
yep, that worked, thanks
Post by 'Kevin Reid' via Google Caja Discuss
Post by felbus
caja.load(document.getElementById('messagebox'), undefined, function(frame) {
frame.code(contentUrl, 'text/html').run();
});
When it is rendered on the page, the images and hrefs are all stripped
out. So you cannot see images or click links.
I am guessing this is the default behaviour to prevent attacks.
My question is how do I allow these to be loaded so that the page is
displayed as intended?
You need to specify the URI policy instead of undefined.
The simplest policy is caja.policy.net.ALL which will allow links and
images for all sites.
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-caja-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...