Reputation: 3439
Suppose I have the following document displayed in an iframe:
<html>
<head>
<style>
@media print { body { color: blue; } }
</style>
</head>
<body>Hi!</body>
</html>
Is there a way to set the iframe's media type to print, so the body color style is activated?
Upvotes: 1
Views: 831
Reputation: 2807
As far as I know, it is not possible to use HTML to / iframes to request a specific @media type. I'd back this up with the follow extension to Firefox developer tools, which explicitly needed to code an API to emulate different media types:
https://bugzilla.mozilla.org/show_bug.cgi?id=819930
Perhaps using SASS or LESS you can avoid copy and pasting all the print code, and nest everything in a body.media-print {} block, allowing you to write the code once, and display it by just adding the media-print class to your body when emulating print mode.
Upvotes: 3