This PHP script checks to see if the user allows cookies. If so, a function is provided to change to an alternate CSS. If the user doesn’t accept cookies, this script offers a message, but normally it shouldn’t, and should instead simply remove the optional function from view.
Get the PHP, source. Go to back to the Mike’s Experiments index.
The is the raw data output by the script. It is these variables that, if properly employed, will alter the CSS import statement to grab the user’s preferred style sheet. Assuming, of course, cookies are allowed. Check it out:
Combining these variables in a CSS import statement will generate the following:
<style type="text/css" media="screen" title="Default Style"> @import "styles/default.css"; </style>
Test it for yourself. Click the link below to change the style. Also note the changes to the raw data shown above. If cookies aren’t enabled no link will be output but on this experiments page you will get a message.
Sorry. The style changer on this site is only operable if style sheets are supported by your user agent or browser!