Javascript代码段不工作(缺少lib?) [英] Javascript snippet not working (missing lib?)

查看:81
本文介绍了Javascript代码段不工作(缺少lib?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我升级了我的Bootply.com帐户,下载了1个无法正常工作的代码段。我在这里错过了什么原始的Bootply.com片段?!



这是我的index.html在Chrome中运行时的样子: Imgur链接。



这些是来自index.html的内容

  <!DOCTYPE html> 
< html lang =en>
< head>
< meta http-equiv =content-typecontent =text / html; charset = UTF-8>
< meta charset =utf-8>
< title> Bootstrap3向导w / FuelUX< / title>
< meta name =generatorcontent =Bootply/>
< meta name =viewportcontent =width = device-width,initial-scale = 1,maximum-scale = 1>
< link href =css / bootstrap.min.css =stylesheet>
< link href =// maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css =stylesheet>
<! - [if lt IE 9]>
< script src =// html5shim.googlecode.com/svn/trunk/html5.js\">< ;;script>
<![endif] - >
< link href =css / styles.css =stylesheet>
< / head>

页脚:

 < script src =// ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js\"> ;</script> 
< script src =js / bootstrap.min.js>< / script>
< script src =js / scripts.js>< / script>


解决方案

更改以开头的网址/ / https://< url>

 <!DOCTYPE html> 
< html lang =en>
< head>
< meta http-equiv =content-typecontent =text / html; charset = UTF-8>
< meta charset =utf-8>
< title> Bootstrap3向导w / FuelUX< / title>
< meta name =generatorcontent =Bootply/>
< meta name =viewportcontent =width = device-width,initial-scale = 1,maximum-scale = 1>
< link href =css / bootstrap.min.css =stylesheet>
< link href =https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css =stylesheet>
<! - [if lt IE 9]>
< script src =https://html5shim.googlecode.com/svn/trunk/html5.js>< / script>
<![endif] - >
< link href =css / styles.css =stylesheet>
< / head> < script src =https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js>< / script>
< script src =js / bootstrap.min.js>< / script>
< script src =js / scripts.js>< / script>

页脚:

 < script src =https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js>< / script> 
< script src =js / bootstrap.min.js>< / script>
< script src =js / scripts.js>< / script>

原因是您在本地打开html文件。请注意,在地址栏中,协议是 file:// 。但是,当它在Web服务器上运行时,它会工作,因为协议是 http:// https://

更新:



讨论移至 this thread


I upgraded my Bootply.com account to download 1 snippet which is not working properly. What am I missing here the original Bootply.com snippet?!

This is what my index.html looks when I run it in Chrome: Imgur link.

These are the includes from the index.html

   <!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <title>Bootstrap3 Wizard w/ FuelUX</title>
        <meta name="generator" content="Bootply" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
        <!--[if lt IE 9]>
            <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <link href="css/styles.css" rel="stylesheet">
    </head>

Footer:

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>

解决方案

Change urls starting with // to https://<url>.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <title>Bootstrap3 Wizard w/ FuelUX</title>
        <meta name="generator" content="Bootply" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
        <!--[if lt IE 9]>
            <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <link href="css/styles.css" rel="stylesheet">
    </head>     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/scripts.js"></script>

Footer:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>

The reason is that you are opening the html file locally. Note that in the address bar, the protocol is file://. When you run it on a web server, however, it would work because the protocol is either http:// or https://.

Update:

Discussion moved to this thread.

这篇关于Javascript代码段不工作(缺少lib?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆