Printing from an iframe in modal window in IE 7

by Andy 5/16/2008 10:13:00 AM
Printing of foupon in Iframe

I recently started loading our printable foupons into an embedded iframe which was displayed using a modal window (light box style)

Something I didn't realize when I started doing this is that IE 7's new shrink to fit printing caused the contents of my iframe to shrink down according to width of the iframe in its container.

To get around this I created a seperate style sheet containing

@media print
{

*
{
     display:none !important;
}

.fouponPopup
{
     display:block !important;
     width:100% !important;
     position:absolute !important;
     left:0px !important;
     top:0px !important;
}

.fouponPopup iframe
{
     display:block !important;
     width:100% !important;
}

}

Then in JS before showing the modal window (using AjaxControlToolKit) I add the style sheet to the header

fileref = document.createElement("link");
fileref.setAttribute(
"rel", "stylesheet");
fileref.setAttribute(
"type", "text/css");
fileref.setAttribute(
"href", website + "styles/print.css");
document.getElementsByTagName(
"head")[0].appendChild(fileref);

with fileref being a global variable.  Then when the user hits the close botton I remove the fileref object from the head.

document.getElementsByTagName("head")[0].removeChild(fileref);

I had to dynamically add/remove the css file so that users could print the pages normally in all other cases.

I am not 100% this is the best option to get around this issue in IE 7.  But it works.

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , , , ,

Developement

Foupons.com in .net 3.5 Finally...

by Andy 4/30/2008 6:38:00 PM

It's alive!!!

Well at least live.  We just put live the newester version foupons.com.

The newest version of foupons.com utilizes the new Microsoft.net 3.5 framework. And let me just say that was no picnic.  Most of the transition was straight forward enough until we hit some snags with the the AjaxControlToolkit.

Why microsoft in their great wisdom feel that everything client side should be able to be written in c# and translated is beyond me.  Atleast with platforms like Anthem.net (which we have utilized previously) they did a wonderfully seemless job of encapsulating the most desired functionality.

In an attemp to not create too much client side bloat we tried to establish most listeners dynamically client side.  Which apparantly was not the original intent of Microsoft as this is less then straight forward.  That being said the Sys.Services.AuthenticationService is rather nice. 

I think they could definitely take a few more pointers from prototype and mootools as far as what js prgrammers are looking for and stop trying to make it match server side page functionality.

At any check it out and look forward to new enhancements to be built off the new framework.

Enjoy!

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , , ,

Developement

©2008 Foupons LLC
www.foupons.com

Welcome to Foupons Press

Let us know what you think!

E-mail US Send mail

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Pages

    Recent posts

    Recent comments

    • Back on Track (1)
      Frank Smith wrote: That is crazy! I love the site keep up the great … [More]

    Archive

    Disclaimer

    Any comments made are those of our readers and do not represent foupons.com view in anyway.

    © Copyright 2009

    Sign in