Ashus.ashus.net
How to insert separately styled HTML e-mail to heavily styled page - Printable Version

+- Ashus.ashus.net (https://ashus.ashus.net)
+-- Forum: My creations (https://ashus.ashus.net/forum-3.html)
+--- Forum: Guides / NĂ¡vody (https://ashus.ashus.net/forum-8.html)
+--- Thread: How to insert separately styled HTML e-mail to heavily styled page (/thread-178.html)



How to insert separately styled HTML e-mail to heavily styled page - Ashus - 7.3.2017

Use iframe like this!


Code:
<iframe id="unstyled-text" sandbox="allow-scripts allow-popups allow-same-origin" srcdoc="<?= htmlspecialchars('<head><base target="_blank"></head><body>' . $html . '</body>') ?>"></iframe>
<script>
    $(function(){
        // hack for IE and browsers without srcdoc support
        var $u = $('#unstyled-text');
        var $body = $u.contents().find('body');
        if ($body.html() == '')
            $body.parent().html($u.attr('srcdoc'));
    });
</script>