rgirardin
rgirardin

Reputation: 33

can javascript "detect" browser print settings (specifically if print background colors is selected)?

I would like to know if I can use JavaScript to detect if the browser's print settings will display background colors. I have no desire to try to alter the setting, I would just like to respond to the settings state.

I'm still relatively new to JS and I apologize if this is repeated elsewhere, but I've spent a few hours searching and everything I've come up with is about setting the state, rather than merely getting it.

My use case is this:

I have CSS progress bars with inner and outer div's. The inner div width and color display the progress (color changes based on certain criteria). Most of the viewing will be on screen, and 95% of printing will be to PDF, the remaining 5% of printing will be to the printer. What I would like to do is use JS & CSS to display the progress bar one way if the user has selected to display background color and another if he hasn't. Is there any way I can read the setting in JS i.e. pseudo code:

doesDisplayBackground = browser.settings.printer.displayBackgroundColors;

Right now I'm just using my no background color solution for all printing but it's nowhere as nice as the colored solution so I'm hoping there's something that will do the trick but I can live without it.

TIA

Upvotes: 3

Views: 1053

Answers (1)

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114377

The browser's printer setting are not scriptable. All you can do is use a print stylesheet.

Upvotes: 3

Related Questions