简体   繁体   English

页面仅加载最后链接的JavaScript文件,Google字体API也停止工作

[英]Page only loads the last linked javascript file, also google font API stopped working

I'm programming a website in PHP 5 and for convenience I've elected to use includes for the header and footer on each page. 我正在使用PHP 5对网站进行编程,为方便起见,我选择使用include作为每个页面的页眉和页脚。

My html and head setup looks like this atm, and had been unchanged since I started 我的html和head设置看起来像这个atm,自从我开始以来就一直没有改变

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html lang='en'>
    <head>
        <meta charset='utf-8'>
        <!--[if IE]><![endif]-->
        <title>TITLE</title>
        <meta name='description' content=''>

        <link href='http://fonts.googleapis.com/css?family=Droid+Sans:regular,bold&subset=latin' rel='stylesheet' type='text/css'>
        <link rel='stylesheet' href='css/default.css'>
        <link rel='stylesheet' href='css/bbeditor.css'>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script> 
        <script src="js/jQuery.js" type="text/javascript"></script> 
        <script src="js/bbeditor.js" type="text/javascript"></script> 
    </head>

As you can see I use some jquery, a nice simple bbeditor for user input and the google font api. 如您所见,我使用一些jquery,一个不错的简单bbeditor用于用户输入和google font API。 What started happening was that I could only load the last mentioned javascript file for some reason, in this case, it would be the bbeditor. 开始发生的事情是由于某种原因我只能加载最后提到的javascript文件,在这种情况下,它将是bbeditor。 not only that, the font api just wont load at all. 不仅如此,字体api根本不会加载。

I should mention that the CSS files load perfectly fine however. 我应该提一下,CSS文件可以很好地加载。

Does anyone know what's going on? 有人知道发生了什么吗?

Try using firebug's "Net" tab, it will show you all the requests and responses. 尝试使用Firebug的“网络”标签,它将显示所有的请求和响应。 Firstly check the Status column and, if something's wrong, the response. 首先检查“状态”列,如果有问题,请检查响应。

Try closing your one-line tags: 尝试关闭单行代码:

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html lang='en'>
    <head>
        <meta charset='utf-8' />
        <!--[if IE]><![endif]-->
        <title>TITLE</title>
        <meta name='description' content='' />

        <link href='http://fonts.googleapis.com/css?family=Droid+Sans:regular,bold&subset=latin' rel='stylesheet' type='text/css' />
        <link rel='stylesheet' href='css/default.css' />
        <link rel='stylesheet' href='css/bbeditor.css' />
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script> 
        <script src="js/jQuery.js" type="text/javascript"></script> 
        <script src="js/bbeditor.js" type="text/javascript"></script> 
    </head>

Note the /> at the end of link and meta tags. 请注意linkmeta标记末尾的/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM