0

Hi..
I'm having a problem of redirect my website to use another style sheets for ie and chrome.

This is the way i've done for ie detection :

<!--[if IE 8]>
      <link rel="stylesheet" type="text/css" href="css/ie8.css" />
      <! [endif] -->

and this is the way i've done for chrome detection :

<script type="text/javascript">
      if (navigator.userAgent.toLowerCase().match('chrome')
      document.write('<link rel="stylesheet" type="text/css" href="css/stylechr.css">');
      </script>

but the problem is none of these are working,and i'm in trouble now of fixing the stylesheet for these two browser.
please help,i really dont know what else to do.

Thank You :)

Edited by samsons17: n/a

4
Contributors
11
Replies
13
Views
6 Years
Discussion Span
Last Post by castle13
0

Try this for IE 8

<!--[if gt IE 7]>
	<link rel="stylesheet" type="text/css" href="css/ie8.css" />
<![endif]-->

AND TRY THIS FOR CHROME

<link rel="stylesheet" href="css/stylechr.css" type="text/chrome" />
0

Try this for IE 8

<!--[if gt IE 7]>
	<link rel="stylesheet" type="text/css" href="css/ie8.css" />
<![endif]-->

AND TRY THIS FOR CHROME

<link rel="stylesheet" href="css/stylechr.css" type="text/chrome" />

i dont know why...but it is still not working :( help2,please....

0

Did you link the style sheets correctly? css/ie8.css means that the folder css must be in the same directory as your site, and the file ie8.css must be in the css folder. Same with the chrome one.

0

yes..i already put it on the right directory and folder.
and this is a new thing that i realised,
when i open my website on the LAN address,i mean like :
http://161.0.1.64/ryzalyusoff.com/public/index.php
my website appear correctly..

but when i open it up using the localhost address which is :
http://localhost/ryzalyusoff.com/public/index.php ,my website appear wrongly.

how could this is being so?now i dont know,wheter the redirection code is not working or something else..
really make me confuse right now..

0

Your website will appear correctly at the path you defined in your config.php file. If localhost is not defined, it cannot appear there.

As for your original problem:

If you say it appears correctly on your LAN, do you mean in all browsers now, or only in some?

0

Your website will appear correctly at the path you defined in your config.php file. If localhost is not defined, it cannot appear there.

As for your original problem:

If you say it appears correctly on your LAN, do you mean in all browsers now, or only in some?

nope..by using LAN, it only appear correctly on mozilla and ie only,but not for chrome..

0

OK, so your IE problem is now sorted out, I gather.

For Chrome, try the full path to the stylesheet and see what happens.

<link rel="stylesheet" href="http://full/url/to/css/stylechr.css" type="text/chrome" />

Also, make sure the code for stylesheet is in the <head></head> section of your file.

Also make sure stylesheet starts with:

The first characters in the css-file should be:

@charset “UTF-8″;
0

OK, so your IE problem is now sorted out, I gather.

For Chrome, try the full path to the stylesheet and see what happens.

<link rel="stylesheet" href="http://full/url/to/css/stylechr.css" type="text/chrome" />

Also, make sure the code for stylesheet is in the <head></head> section of your file.

Also make sure stylesheet starts with:

The first characters in the css-file should be:

@charset “UTF-8″;

I cannot save the css file with @charset “UTF-8″;
a message pops up said that "it may contain chars that cannot be represented in current encoding."

0

ok, did you define the exact path now? You may also want to test what happens if you remove the doc type from the html tag at beginning of your file.

If not resolved, please post your chrome style sheet css code, and your index.php html here.

0

Make Sure that ur Link in the href is placed right. Check my code below if ur using a wordpress CMS :

<script type="text/javascript">
if (navigator.userAgent.toLowerCase().match('chrome'))
document.write('<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/stylechr.css" />')
</script>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

0
<link rel="stylesheet" href="css/stylechr.css" type="text/chrome" />

works fine with me , thanx guys

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.