Monday, June 6, 2011

How can I change code on my website IF user visiting is using IE6?

I can't afford to keep fully supporting IE6, it ruins many things. The website is still readable, it just looks less appealing with the layout a bit distorted. Therefor I want to bring up a dialog box if the user is visiting on a browser that is IE6 or lower. Basically, how can I determine this using code?



Thanks very muchHow can I change code on my website IF user visiting is using IE6?
Use a separate CSS file for IE and set up conditional statements to call it.



Conditional Statements: http://msdn.microsoft.com/en-us/library/



RonHow can I change code on my website IF user visiting is using IE6?
You could just design an alternative version of your website and make a link to it saying ';Click here if you're usiing IE6';.
If you mean Javascript, I would strongly encourage the use of a nice javascript framework. Personally, I'm a fan of Prototype. Others include MooTools, Dojo, and a zillion more (wikipedia has a list somewhere). These kinds of frameworks can greatly mitigate cross-browser compatibility woes. Anyway, you could try googling for ';javascript browser detection';. The basic idea is to parse `navigator.userAgent` to determine what browser is being run.



If you're not using JavaScript for this, then it depends on what language you are using. Basically, there should be a variable of some sort to retrieve the headers the user sent. One of those headers will be their user-agent. In PHP for example, it's in $_SERVER['HTTP_USER_AGENT']. Then parsing proceeds same as with JavaScript (google can help here).
yes IE6 is a pain, I pray everyday that the worlds gets rid of the aweful thing!



There is one good practice step you should do before resorting to making a new CSS file. I would highly recommend you validate your website against the World Wide Web Consortium standard. http://validator.w3.org/

I find although most errors they report will not fix your IE6 compatibility issue, it certainly helps some issues.



Once you have made your separate CSS file for IE6 users, then put something like this underneath your existing CSS link your page:



%26lt;!--[if IE 6]%26gt;

%26lt;link rel=';stylesheet'; type=';text/css'; href=';yourStyleSheet.css'; /%26gt;

%26lt;![endif]--%26gt;
  • name for a male
  • How to clean a comforter without a washer
  • No comments:

    Post a Comment