5 Replies - 626 Views - Last Post: 11 December 2010 - 02:55 AM

#1 Guest_Arthur*


Reputation:

Java script Newcomer

Posted 09 December 2010 - 09:15 AM

Recently I've been developing a website for a friends business, and making it I realised that I wouldn't be able to make one version that could work in all browsers, so I started making a few different version with different style sheets so that it would work in IE, Chrome and Mozilla.

I assumed it would be quite a simple piece of code I'd have to use to make the web page check the browser then open the specific web page, but I was wrong, I've spent hours looking around on the internet for a tutorial on how to do this, and none of them have really been helpful, so I was wondering if anyone knew of a tutorial for this particular problem or could maybe send me on the right track.

Thanks, Arthur

Is This A Good Question/Topic? 0

Replies To: Java script Newcomer

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 9042
  • View blog
  • Posts: 33,540
  • Joined: 27-December 08

Re: Java script Newcomer

Posted 09 December 2010 - 09:24 AM

Javascript isn't the best tool for this, as it can be disabled. If you are using a server-side language like PHP, ASP.NET, or ColdFusion, use that to check the browser.
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 2899
  • View blog
  • Posts: 7,555
  • Joined: 08-June 10

Re: Java script Newcomer

Posted 09 December 2010 - 09:46 AM

a website working in all browsers is not that complicated. first of all you need a valid HTML page (check in http://validator.w3.org/). using CSS2.1 should work in all browsers and if there are issues in IE, you can serve IE specific CSS by using conditional comments.
Was This Post Helpful? 0
  • +
  • -

#4 signedoutz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 11-January 09

Re: Java script Newcomer

Posted 10 December 2010 - 06:23 PM

View PostDormilich, on 09 December 2010 - 08:46 AM, said:

a website working in all browsers is not that complicated. first of all you need a valid HTML page (check in http://validator.w3.org/). using CSS2.1 should work in all browsers and if there are issues in IE, you can serve IE specific CSS by using conditional comments.


What's a conditional comment?

I mean what language would that be written in?
Was This Post Helpful? 0
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 2899
  • View blog
  • Posts: 7,555
  • Joined: 08-June 10

Re: Java script Newcomer

Posted 11 December 2010 - 01:03 AM

a conditional comment is a special syntax of a HTML comment of IE.
Was This Post Helpful? 0
  • +
  • -

#6 moopet  Icon User is offline

  • binary decision maker
  • member icon

Reputation: 334
  • View blog
  • Posts: 1,178
  • Joined: 02-April 09

Re: Java script Newcomer

Posted 11 December 2010 - 02:55 AM

It's definitely not rocket science to make a site that looks the same in firefox/chrome/safari etc - or at least close enough given font changes and so forth - so your only problem should be IE, which will be solved with a separate stylesheet in a conditional comment as Dormilich suggested. Note that you will probably end up with something like this:

1 normal stylesheet
2 conditional stylesheet for IE8 overrides
3 conditional stylesheet for IE7 overrides
4 conditional stylesheet for IE6 overrides
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1