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

User avatar
Ashus
Administrátor
Posts: 417
Joined: 07. 07. 2007 10:51
Location: Ostrava - Polanka nad Odrou
Contact:

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

Postby Ashus » 07. 03. 2017 15:15

Use iframe like this!

Code: Select all

<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>
Image
Coffee phreak!

Who is online

Users browsing this forum: No registered users and 1 guest

cron