Forum Moderators: not2easy

Message Too Old, No Replies

server-side CSS "fixer"? (like IE7)

         

ocelot

1:06 am on Oct 22, 2004 (gmt 0)

10+ Year Member



man, I can't tell you how long I've been waiting for something like IE7! It's wonderful. It's just too bad that a noticeable chunk of my traffic has javascript turned off though.

Is there possibly something like it that works on the server side that I haven't heard of?

Also, if not, there's got to be a way to make IE7 run on the server right? but how...? I was thinking there might be a way to "embed" it inside a scripting lang like PHP or something...

bedlam

1:32 am on Oct 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Heh ;)

I don't want to disappoint you, but there is no server-side solution to this client-side problem. The problem, after all, is that the Internet Explorer browser does not correctly/fully support various parts of the CSS standards.

Remember that what a server does is (mostly) just serve up html and media files on request; the degree to which it can interact with a browser is minimal - it certainly can't have any influence on how the browser renders the code and media files the server serves up. Making IE7 run on the webserver also couldn't have any effect (other than maybe making any instance of IE installed on the server render CSS pages correctly...but that wouldn't be much help to the site's visitors).

Think of it this way: if your monitor is broken, and all the colours are wrong, nothing you can do with your video card will solve the problem...

-B

createErrorMsg

1:52 am on Oct 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Making IE7 run on the webserver also couldn't have any effect

You absolutely couldn't run IE7 on the server, but another question might be, would a server-side script that mimics the behavior of IE7 be possible? And I think this depends on exactly how IE7 accomplishes what it accomplishes (and I have no idea what the answer to that is).

If IE7 makes alterations to the style objects in the DOM, i.e., detects parts of the styles() array that IE will choke on and changes them to mimic the behavior of hacks, then wouldn't a server-side solution be possible in the form of a script that (a)browser sniffs for IE5, then (b)runs through the CSS file looking for signs of code that will trip up IE5, and rewriting that code to an IE friendly version? Obviously, you can't alter the DOM with a server-side script, but you could alter the CSS before it's sent...a sort of on-the-fly stylesheet editor coded with certain things to detect, calculations to make, and new things to be written.

But I can't even imagine the complexity of a script like that...

bedlam

2:05 am on Oct 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You absolutely couldn't run IE7 on the server

Sure you could. But as I mentioned, it wouldn't have any effect on the pages served... ;)

Obviously, you can't alter the DOM with a server-side script, but you could alter the CSS before it's sent...a sort of on-the-fly stylesheet editor coded with certain things to detect, calculations to make, and new things to be written.

Well, I took the original poster's question to be 'is there a server-side way to fix IE without having to learn all that CSS?' You could obviously use the webserver to deliver css tailored to IE's um...peculiarities, but I wonder if this wouldn't be a more complex solution than just learning how to cope with the darned browser :-p

-B

vkaryl

2:14 am on Oct 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



....but I wonder if this wouldn't be a more complex solution than just learning how to cope with the darned browser....

Well, probably. BUT - if one could code something like this, wouldn't the possibility of deployment across numerous servers be a plus?

Of course, that really WOULD give a certain company reason to simply bag making the "bad boy browser" compliant....

ocelot

12:33 am on Oct 23, 2004 (gmt 0)

10+ Year Member



I'm not sure everybody's understanding me right, or maybe I'm not understanding everybody else.

What I'm saying is that wouldn't it be possible to write a server side script that gets the browser id from the client and then uses it in order to make the proper changes to a fully compliant CSS file so that it shows up right in IE?

Or better yet, since somebody already spent a bunch of time writing IE7 in JS and it would take just as much time to write the same thing in a server side lang such as php, wouldn't it be possible to have a server-side script sort of "encapsulate" the JS? so the php or whatever would
1. check the browser id
2. pass the browser id and the fully compliant CSS file to the IE7 script running "inside" php
3. IE7 would process the script and return the output to php so that it can send it off to the client along with the html

vkaryl

12:50 am on Oct 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ocelot, you left me round that last bend. I don't write anything but MUSH softcode, so while what you said sounds reasonable to me, I don't really have anything to base an assumption on.

It SOUNDS like it would be a wonderful option. But I honestly haven't a clue whether it's doable or not. And if it were doable, would it still have the "stop" problem that IE7 has: that is, that someone who disables js (or something else entirely!) in hisser browser trashes the whole "fix"?

Lance

1:11 am on Oct 23, 2004 (gmt 0)

10+ Year Member



I've used IE7 briefly, and I can tell you a couple of things...

To resolve :hovers on any element, it attaches mouseovers. To resolve position: fixed, it uses IE expressions.

So one short answer is yes, disabling javascript would kill it regardless of the source. The best you could do server side is sniff and present equivalent code to the client, which would end up having to be j.s based one way or another.

createErrorMsg

1:33 am on Oct 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



2. pass the browser id and the fully compliant CSS file to the IE7 script running "inside" php
3. IE7 would process the script

Since javaScript is a client side programming language, and does most of it's work on the DOM (document object model) that is created by the user agent each time a page loads, I really don't think there's anyway to process with IE7 on the server side.

Here's another way to look at it: javaScripts that affect styles on a page do not actually make any changes to the CSS file, itself. Rather, they access an array of style rules stored in the DOM when the page is loaded. Say you write a font size switcher in JS for your web site. Clicking a link makes the font size go up. Clicking anther makes it go down. To accomplish this, you write the script to alter the font-size property of, say, the body tag, but this script doesn't change the ACTUAL font-size property in the stylesheet. It changes the fontSize property in the stored styles array. Reloading the page (without a cookie), reloads the actual stylesheet and the old, hard-coded font size returns.

Since php makes actual changes to documents before serving them, there's no way for javascript to have an effect on the DOM (b/c it doesn't exist until the UA builds it).

(Note: probably ought to add that this is all to the best of my knowledge.)

I have no doubt, however, that PHP has all the capability you would need to emulate what IE7 does. In other words, you could certainly write a script that would take the existing stylesheet, process it by detecting certain settings that IE won't like (like a width-ed box with padding, or a left floated element with a left margin), calculating the needed changes for IE (increased box size, display:inline), writing them into the css file, then serving that new css file.

vkaryl

1:37 am on Oct 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cEM: Okay, that makes sense. So why hasn't someone written that php script?

vinzzz

10:47 am on Oct 23, 2004 (gmt 0)

10+ Year Member



cEM: whats with making a proper css file server-side. If the damn thing wouldnt work with normal css, then its no use detecting the UA and try to make a alternative css file? some things will never be fixed, cause the lack of IE

claus

11:28 am on Oct 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just posting a note that "IE7 is not a new version of the browser Internet Explorer from Microsoft - in stead it is an open source javascript"

I had to do some browsing at Microsoft.com and Google.com to realize that, as it's mentioned nowhere above :)

createErrorMsg

2:20 pm on Oct 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cEM: whats with making a proper css file server-side. If the damn thing wouldnt work with normal css, then its no use detecting the UA and try to make a alternative css file? some things will never be fixed, cause the lack of IE

vinzz, I'm afraid I don't understand your question/post. Could you clarify what you mean?

DrDoc

6:03 am on Oct 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



why hasn't someone written that php script?

Because regardless of whether you use JS or PHP to calculate the modifications needed, some of the functionality still requires JS! You can't fake :hover or fixed positioning without using JS (or some other client side scripting language) for IE.