html - Chrome loading the contents of a PHP file into a CSS file -


my website loads on firefox, css disappears on chrome (although html loads).

according console, seems because chrome loading contents of index.php main.css , bannertest.css so:

main.css loading incorrectly

on firefox, however, loads css expected: enter image description here

things have tried did not work:

  • clearing history/cache/cookies
  • adding text/css tags. did make text render little weirdly on firefox.
  • css , html validation. fixed semi-colons , such. still doesn't work.

what's problem? can't figure out steps take investigate what's going on more deeply, let alone figure out problem itself. no errors printed console far can tell.

here index.php:

<!doctype html> <!--[if lt ie 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if ie 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if ie 8]>         <html class="no-js lt-ie9"> <![endif]--> <!--[if gt ie 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <title>study</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content="">  <link href="css/bannertest.css" rel="stylesheet"> <link href='http://fonts.googleapis.com/css?family=montserrat:400,700' rel='stylesheet' type='text/css'> <link href="css/main.css" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>  <style> /**  * banner assumes margin of 0px, not included  * in banner.css avoid collisions other themes ,   * admin bars.  */ body {   margin:0px; } </style>  <link rel="icon" type="image/ico" href="favicon.ico">  </head>  <body> <?php  //connect mysql database. $host = "127.0.0.1"; $user = "root"; $password = "password"; $database = "database";  $r = mysql_connect($host, $user, $password);  if (!$r) {     echo "could not connect server.\n";     trigger_error(mysql_error(), e_user_error); }  $query = "create database if not exists " . $database;  mysql_query($query);  @mysql_select_db($database) or die("unable select database.");  $query="create table if not exists `groupcodes` (`groupcode` int(10) primary key, `usercode` int(10))";  mysql_query($query);  $userid = "";  ?>  <div id="banner"> <div id="u-header-container"> <div class="container">   <div class="row-fluid">     <div id="home-link-container">       <a id="home-link" href="http://csue.edu/">         <span id="wordmark">u</span>         <span id="university">university</span>       </a>     </div>   </div>   </div>   </div> <div id="database-container">     <header>         <a href="index.php">         <h4 id="logo">computing systems</h4>         <h1 id="study_logo">study</h1>         </a>     </header> <div id="study">      <form method="post" id="consent-form" action="<?php echo htmlspecialchars($_server["php_self"]);?>">          <div class="wide-column">             <p>             clicking 'acccept' button below, hereby acknowledge following:             </p>              <p>             18 years of age or older, live in united states, , have google drive or dropbox account.              have read form , decided participate in project described above.              general purposes, particulars of involvement, , possible risks , inconveniences have              been explained satisfaction. understand can withdraw @ time.             </p>          </div>     <input type="text" name="email_input">     <br>     <input type="submit" value="begin study">     </form>  </div> </div>  </div>  </body> </html> 

you misdiagnosed problem. due visiting different urls load html document rather using different browsers. switched browsers @ same time switched urls.

look @ url being loaded in first image:

http://localhost/peergroup/index.php/css/main.css 

in chrome must visiting http://localhost/peergroup/index.php/ while in firefox visiting http://localhost/peergroup/index.php (without / @ end).

this causing relative urls computed differently.

a workaround use urls relative site root (i.e. starting /).


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -