I'm curious to learn the best technique for allowing users to add javascript to pages in an app without opening a security can of worms.
For a long time I thought this was impossible, but I was kicking the tires on the hosted e-commerce product Tictail and their customization tool allows you to add any markup and javascript that you want. I'm very curious how they might be doing this without becoming vulnerable to exploits.
Below are some test scripts I added to a page, and the results.
<script>
alert(document.cookie)
</script>
that works, and an alert is triggered - will the page run anything?
<script>
document.body.style.display = 'none';
</script>
that does not work - the script tag loads in the page as-is, but an error is shown in the console: Uncaught TypeError: Cannot read property 'style' of null
Thanks for any ideas/insights.