相关疑难解决方法(0)

我该如何重构这些脚本标签?

我有以下脚本标记,<head>以便在SSL和非SSL页面之间来回切换时不会出现任何安全错误.但它看起来很毛茸茸.

我可以用任何方式组合它们或减少一些代码吗?

<script type="text/javascript">document.write(["\<script src='",("https:" == document.location.protocol) ? "https://" : "http://","ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' type='text/javascript'>\<\/script>"].join(''));</script>
<script type="text/javascript">document.write(["\<script src='",("https:" == document.location.protocol) ? "https://" : "http://","html5shiv.googlecode.com/svn/trunk/html5.js' type='text/javascript'>\<\/script>"].join(''));</script>
<script type="text/javascript">document.write(["\<script src='",("https:" == document.location.protocol) ? "https://" : "http://","use.typekit.com/12345.js' type='text/javascript'>\<\/script>"].join(''));</script>
Run Code Online (Sandbox Code Playgroud)

javascript refactoring

3
推荐指数
1
解决办法
155
查看次数

通过https over http提供CDN内容的优点

所有谷歌的CDN 都通过http s提供.通过https over http服务他们有什么好处吗?

google-cdn

3
推荐指数
2
解决办法
1967
查看次数

$ function not working(丢失?)

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript">
$('div'); // <--- THIS DOESN'T WORK
</script>
Run Code Online (Sandbox Code Playgroud)

我在上面的代码中收到错误.在检查.js代码时,我找不到一个名为的函数$,但根据文档,它应该是一个.

javascript jquery

1
推荐指数
1
解决办法
88
查看次数

Grunt cdnify创建了破碎的AngularJS CDN链接

我使用Yeoman/Grunt和Angular生成器,运行后grunt build,我的dist/index.html中的AngularJS引用如下所示:

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

所以,http:缺少,我手动必须改为:

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

原始index.html中,引用如下所示:

<script src="bower_components/angular/angular.js"></script>
Run Code Online (Sandbox Code Playgroud)

这是我的配置错误Gruntfile.js吗?

angularjs gruntjs yeoman

0
推荐指数
1
解决办法
1410
查看次数