Welcome Guest, Not a member yet? Register   Sign In
css path problem in firefox
#1

[eluser]murtuza54[/eluser]
Hi

I have made one view in which i have attached one css file.
for the css path i have called a function from Include_path library.
it returns the proper path. i can see the exact path of css in source file of page.
it works well with IE. but it is not showing css effects in Mozilla Firefox.
i have put name of library in autoload.php


//Library function
class Include_path
{
function get_css()
{
return ($_SERVER['DOCUMENT_ROOT']."/css/new.css");
}
}

//view
<html>
<head>
<title>hello</title>
<link href="<?php echo $this->include_path->get_css();?>" type="text/css" rel="stylesheet" />
....


source in IE
<link href="C:/new/css/new.css" type="text/css" rel="stylesheet" />
and it works fine..

source in firefox
<link href="C:/new/css/new.css" type="text/css" rel="stylesheet" />
and it doesnt show any effect of it.

can anyone help me?
#2

[eluser]Colin Williams[/eluser]
I could only guess that IE is resolving it to the file:/// protocol, and Firefox isn't. Either way, you shouldn't really be relying on Windows to be a file server. The request ought to go through your server (like IIS or Apache)
#3

[eluser]kgill[/eluser]
IE is tied into windows and built to be too forgiving of mistakes so it actually renders all kinds of crap it shouldn't - firefox on the other hand is a little more strict about stuff.

If you want it to work as is use href="file:///c:/path/to/file.css" but as has been mentioned that's the wrong way to go about it. Instead you should be using a reference relative to your webroot,
e.g. href="/path/to/file.css" where that first slash represents whatever you've got your DocumentRoot (if you're using Apache) set to. If you leave off the beginning slash the server assumes you are starting in the current directory so href="file.css" means look in the same directory as index.php for the css file.

- K




Theme © iAndrew 2016 - Forum software by © MyBB