A List Apart Alternate Stylesheets and MS Word (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


mtfm -> A List Apart Alternate Stylesheets and MS Word (8/1/2007 13:08:43)

I use alternate stylesheets, and because my company uses IE6, I have to use a workaround so that they are viable. I have been using this page from A list apart and it has been working nicely.

Now, I was messing around with something, and noticed that when an end user hits the button to "edit this page with MS Word" that MS Word only takes the first stylesheet listed.

Because I have a couple of pages with "sensitive" information-- I was wondering if I could use this to my advantage and declare a "fake" stylesheet for MS Word, so that when Word pulls the page I can "hide" information from it word. I already can hide it from being printed, but it is so easy to import into word and print from there. Now, since the normal cascade is that the last one declared is used (rather than MS Word where the first one is used) it shouldn't affect anything else.

Anyone see problems with the below code? It validates, and seems to work, but I just wanted to make sure from an accessibility point of view that it wouldn't mess something up.

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Title Goes Here</title>

<link rel="stylesheet" type="text/css" href="stylesheet_for_printing.css" media="print">
<link rel="stylesheet" type="text/css" href="stylesheet_for_msword.css" title="MSWord">
<link rel="stylesheet" type="text/css" href="stylesheet1.css" media="all"  title="standard">
<link rel="alternate stylesheet" type="text/css" href="stylesheet2.css" title="stylesheet2">
<link rel="alternate stylesheet" type="text/css" href="stylesheet3.css" title="stylesheet3">

<script type="text/javascript" src="styleswitcher.js">
</script>
</head>




Tailslide -> RE: A List Apart Alternate Stylesheets and MS Word (8/1/2007 14:54:03)

What sort of info are you trying to hide?

It seems like a lot of trouble to go to when all the info can be "got at" by someone who really wants it. What I'm trying to get at is that as you can't stop them getting at the information, is there a point to stopping people downloading it with Word?

To be honest I've never noticed that Word does this - I'd be really careful about testing in other browsers to make sure they're not somehow picking up the Word stylesheet by accident.

Since I'm here - do you mind if I ask why you're using an stylesheet switcher for IE6 when you could use conditional comments instead (easier to manage imo).




mtfm -> RE: A List Apart Alternate Stylesheets and MS Word (8/1/2007 15:07:20)

I work for a large company, and this content is going on the intraweb, where the only browser it is seen by is IE6. I use alternate stylesheets just so that the users can change colors, text size, etc. (most users are not computer-savvy enough to change text size on their own, but understand "click this button to get bigger text!")


As to the information I am trying to 'hide" I am not trying to make it truly unavailable, just somewhat limited in distribution. The intraweb is behind a firewall, meaning that no one outside the company can get to it. But some people (in the sales force) will print out procedures and whatnot, or otherwise "borrow" content to use in their presentations to the customer, contents which are supposed to be for internal use only and are not suitable for the customer. I am simply trying to throw enough obstacles in their way so that there is absolutely no way possible they can obtain this information without some effort and without realizing they shouldn't be doing so.

I am well aware that if someone wants it bad enough they can get to it.




Tailslide -> RE: A List Apart Alternate Stylesheets and MS Word (8/1/2007 16:57:24)

quote:

ORIGINAL: mtfm But some people (in the sales force) will print out procedures and whatnot, or otherwise "borrow" content to use in their presentations to the customer, contents which are supposed to be for internal use only and are not suitable for the customer.


Damn sales people! I can understand what you're getting at now and understand the switcher use (thought it was just because of IE6 rather than to provide alternate presentation).

It's interesting - didn't realise that Word does this and if IE6 is the only browser available then you shouldn't be running the risk of messing up the site - I'd try to get hold of IE7 and just check it's ok in case of upgrades though.

I remember when I used to use this switcher method it was an eternal pain in the arse getting it to work right in different browsers!




mtfm -> RE: A List Apart Alternate Stylesheets and MS Word (8/1/2007 17:15:44)

Interestingly, Word, Excel and Powerpoint (2003 versions at least) all appear to "grab" this first stylesheet and ignore the other ones.
I may have just figured out my very first hack! [&:]

As for upgrades, I don't have and cannot get IE7 on this machine for testing purposes, but if/when they upgrade a lot of the intraweb will likely fail-- so if this site failed it would be in good company. [:D]

Though actually, seeing as how the alternate stylesheets are just different colors/text sizes, as long as any of them were read things would still hobble along! So most of the site is good.

This particular hack would only go on certain specific pages not through the whole site-- So what I'm saying is that at most only one or two pages would fail completely on upgrade. Or so I hope. [8|]




mtfm -> RE: A List Apart Alternate Stylesheets and MS Word (8/1/2007 19:17:53)

UPDATE--

with Javascript turned off, both IE and various Office products want to grab the same stylesheet-- so this doesn't degrade nicely. It works well with JS on, and the alternate stylesheet script works-- but with JS off it all falls apart. And trying various combinations of media types only makes IE either ignore the stylesheets or pull from two or more, which is an interesting experiment to say the least, but NOT something I even want to tackle.

So it looks like I either have to have something that doesn't degrade well, OR just deal with it. And if I'm going to do the first, it's a lot easier and safer to just have a JS include using document.write, Office doesn't appear to pick up on those.


Anyway...




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875