【问题标题】:typeahead.min.js Github link not workingtypeahead.min.js Github 链接不工作
【发布时间】:2014-02-02 19:46:00
【问题描述】:

我使用 bootstrap v3.0.0 和 typeahead.js 实现了一个搜索栏下拉菜单。在我的项目完成时(2个月前)。我使用以下内容来包含模板引擎和 typeahead.min.js

<link href="http://raw.github.com/jharding/typeahead.js-bootstrap.css/master/typeahead.js-bootstrap.css" rel="stylesheet" media="screen">

<script src="http://twitter.github.com/typeahead.js/releases/latest/typeahead.min.js"></script>

 <script src="http://twitter.github.io/typeahead.js/js/hogan-2.0.0.js"></script>

现在突然间,我受到了“这里没有 GitHub 页面”的欢迎。当我尝试访问时

http://twitter.github.com/typeahead.js/releases/latest/typeahead.min.js

http://twitter.github.io/typeahead.js/js/hogan-2.0.0.js

我的搜索下拉菜单不再起作用。我试图用工作链接https://raw.github.com/twitter/hogan.js/master/web/builds/2.0.0/hogan-2.0.0.js 替换 hogan 模板链接 但是 typeahead.min.js here 没有其他选择。事实上,任何版本都没有 typeahead.min.js。现在他们已将其更改为

http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js 

因为它是升级版,所以它不起作用。知道如何找到我正在使用的版本。我真的对正在发生的事情感到困惑,需要你的帮助。谢谢。

【问题讨论】:

标签: javascript twitter-bootstrap github typeahead.js twitter-typeahead


【解决方案1】:

您应该使用CDN 来获取您的 Javascript 依赖项。

例如,如果您使用cdnjs.com,而不是:

<script src="http://twitter.github.com/typeahead.js/releases/latest/typeahead.min.js">

你会使用:

<script src="//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.9.3/typeahead.min.js"></script>

【讨论】:

    【解决方案2】:

    如果您想确保始终使用最新的 master 分支,Github 打破了托管在 raw.github.com 的 javascript 的嵌入。但是,这是一个简单的修复,只需删除“。”域名使用期限:“rawgithub.com”

    原文:

    <link href="http://raw.github.com/jharding/typeahead.js-bootstrap.css/master/typeahead.js-bootstrap.css" rel="stylesheet" media="screen">
    

    变成:

    <link href="http://rawgithub.com/jharding/typeahead.js-bootstrap.css/master/typeahead.js-bootstrap.css" rel="stylesheet" media="screen">
    

    【讨论】:

      猜你喜欢
      • 2021-06-02
      • 2015-07-05
      • 2018-02-12
      • 1970-01-01
      • 2015-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-16
      相关资源
      最近更新 更多