Need to print only the frame and not the whole page using Google Chrome

Praveen Narsipur picture Praveen Narsipur · Nov 14, 2011 · Viewed 50k times · Source

When I try to print the webpage, only the frame appears in the print when using IE or other browsers. However, through the google chrome, the whole page gets printed.

I have done a little research and found out that adding the OpenFrame plugin would do the trick. However, I am looking for the solution without the plugins. Our product is used by a number of customers and we can't ask them to install any plugins.

Can we fix this by making CSS changes or scripts.

Answer

Denes Papp picture Denes Papp · Jan 4, 2014

Using JavaScript you can print frames independently, e.g.

top.frames[1].print()

If you include a print button or listen to print events, you can call your print function that prints only the frame you want.

Or you can use CSS @media print to set what gets printed