css - enable/re-enable
I am working on a web site created entirely by style sheets and for Sec. 508 purposes I need to be able to disable and re-enable style sheets for those who need to view the site in a text only version of the site.
I can kill and re-enable style sheets by hitting the refresh button without a problem:
HOWEVER, what I need to do is find a script that will drop a cookie that will allow the user to continue surfing the site in a “Text Only” mode until they select a “Graphic Version” link that will kill the cookie resulting in the return to the graphic version of the site.
Any help would be appreciated
Busy posted this at 20:44 — 23rd December 2005.
He has: 6,151 posts
Joined: May 2001
And what if the screen reader or persons settings have javascript disabled and cookies turned off?
The only real way to do it is offer a normal text link to text only which can be just the .css file depending how complex the site is, and how many pages ...
If your using firefox as your browser, you can choose (from the tool bar): view/page style/no style
Opera has option to turn of tables etc as well
Renegade posted this at 01:13 — 24th December 2005.
He has: 3,022 posts
Joined: Oct 2002
Have about sessions? Not too sure if text browsers support sessions or not, but I think they do.
dk01 posted this at 10:08 — 24th December 2005.
He has: 516 posts
Joined: Mar 2002
Cookies or sessions will work. Whatever you prefer. Basically you can have a cookies.php include at the top of all your pages. When you include it the page should check for an existing cookie and if the client does not have one then it should set a default cookie (called "version" or something). Once this is set to a 0 or a 1 you can check what version of a page someone wants and do a simple string construction function. Something like this.
First lets assume that 0 stands for the text version and 1 stands for the grafical version of the site.
checker.php
<?php
$domain = \"http://www.mydomain.com\";
$dirs = new Array(2);
$dirs[0] = \"/graphical/\";
$dirs[1] = \"/text/\";
function check($type, $partialPath) { // type is binary (0 or 1)
if ($type==$_COOKIES['version']) { // if the page is the right version then just return
return;
} else { // if the user is on the wrong page direct them to the right page
header(\"Location: \" . $domain . $dirs[$type] . $partialPath);
}
}
?>
Then lets say you had a text version page in http://www.mydomain.com/text/bio/index.php and wanted to implement this script.
In that page you would have the following at the top of the page:
<?php
include(\"cookie.php\"); // make sure the cookies are set
include(\"checker.php\"); // include the checker
check(0, \"bio/index.php\"); // check that we are on the correct page for our version.
?>
So yeah that's basically a rough sketch of how you could work it using only cookies. Now remember you will want to make sure you write exceptions for people who have cookies turned off. Anyhow hope this gets you started. Good luck!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.