Reputation: 12704
I'm building a micro website designer - think MailChimp's email template designer.
As the user builds his site, he'll need to be able to preview it. I want to isolate this preview from the CSS that exists on my app's page. How should I go about doing this?
I can think of two options:
Use a CSS reset. Reset a specific div, and put the preview there. This seems difficult and error-prone, though.
Use iframes. But, aren't iframes like the plague or something?
Upvotes: 1
Views: 1133
Reputation: 2857
If we are using MailChimp API here. There we need to create new campaign every time when we start sending emails.
We can use the campaignCreate() function of MailChimp API
.
function create($type, $options, $content, $segment_opts=null, $type_opts=null)
where we can specify url parameter in the $content associative array.Which represents the html email template been sent. The custom html template url of the project can be customized accordingly.
Upvotes: 0
Reputation: 1536
Iframes are still valid in HTML5 for specific purposes where isolation is required and your requirements seem to suggest them being a potential solution.
Using a div seems to make things more complex. You'd have to deal with the css reset and isolate the parent site from the preview, probably through prefixing your generated style declarations. If your designer includes dynamic script components, you'd have an even bigger headache.
Upvotes: 2
Reputation: 12704
I noticed that MailChimp does, in fact, use <iframe>
s to accomplish this. So there's a vote for iframes.
This answer also has some information. It seems that there's nothing intrinsically wrong with iframes, just that they can be abused. The case at hand appears to be a proper use case.
Upvotes: 1