Change style sheet by javascript

Joined
Apr 24, 2008
Messages
271
Reaction score
6
Points
18
Location
West of Paris
Your Mac's Specs
MacBookPro, iMac, OS 10.13.6, iPhone 6s iOS 15.1, iPad mini, iOS 9.3.5
On the website, we want to have "screen view" for viewing and "print view" for printing.

In the past and when floated objects are located on the webpage, we prepare a pdf file for that.

When no floated objects appear on the page, we want to use instead as "print view" an html view of the same page (same.html file) to reduce work and footprint on the hosting server. In other words, the "print view" is a reliable screen view of what will be printed if we print the "print view" page using the printer

We access the print view via a link called 'print view" which opens a reduced size pop-up window with a degradable javascript

The way the site is programmed today, two stylesheets exist: a standard one for screen viewing called "styles.css" and a special one for print called styles_print.css"

The print view is accessed throug a copy of the original html file "original.html" called original_print.html" and containing a link modified to point to "styles_print.css"

This is cumbersome. Could I simplify this with javascript (or else) to use only one html file (the original.html)

Example page: see <http://tinyurl.com/59m7ar>

TIA
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top