Skip to content

Commit

Permalink
Deprecate protocol-relative URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkettner authored and mathiasbynens committed Apr 16, 2015
1 parent d35a8e9 commit c46ab69
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 39 deletions.
4 changes: 2 additions & 2 deletions dist/doc/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ using some polyfill CDN service, like [cdn.polyfill.io](https://cdn.polyfill.io/
just put it before the other scripts in the bottom of the page:

```html
<script src="//cdn.polyfill.io/v1/polyfill.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://cdn.polyfill.io/v1/polyfill.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.2.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- Add your site or application content here -->
<p>Hello world! This is HTML5 Boilerplate.</p>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.2.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions src/doc/extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ your site, for example) then you can queue up a domain name to be prefetched.

```html
<link rel="dns-prefetch" href="//example.com">
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<link rel="dns-prefetch" href="https://ajax.googleapis.com">
```

You can use as many of these as you need, but it's best if they are all
Expand All @@ -107,7 +107,7 @@ Amazon S3:
Google APIs:

```html
<link rel="dns-prefetch" href="//ajax.googleapis.com">
<link rel="dns-prefetch" href="https://ajax.googleapis.com">
```

Microsoft Ajax Content Delivery Network:
Expand Down
31 changes: 0 additions & 31 deletions src/doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ table of contents](TOC.md)

# Frequently asked questions

* [Why is the URL for jQuery without
`http`?](#why-is-the-url-for-jquery-without-http)
* [Why don't you automatically load the latest version of jQuery from the Google
CDN?](#why-dont-you-automatically-load-the-latest-version-of-jquery-from-the-google-cdn)
* [Why is the Google Analytics code at the bottom? Google recommends it be
Expand All @@ -18,35 +16,6 @@ table of contents](TOC.md)

--

### Why is the URL for jQuery without `http`?

It is because of the use of [protocol-relative
URLs](http://paulirish.com/2010/the-protocol-relative-url/).

**N.B.** If you try to view the local web page directly in the browser, the
browser will fail to load the assets specified using protocol-relative URLs
as it will attempt to fetch them from the local file system. We recommend you
use a local HTTP server to test your web pages, or a file hosting service that
allows you to preview your web pages online (e.g.
[Dropbox](https://www.dropbox.com/)).

Setting up a local HTTP server can be done using there various
[one-liners](https://gist.github.com/willurd/5720255):

* PHP 5.4.0+ by running
[`php -S localhost:8080`](https://php.net/manual/en/features.commandline.webserver.php)
from your local directory
* Python 2.x by running `python -m SimpleHTTPServer` from your local directory
* Python 3.x by running `python -m http.server` from your local directory
* Ruby 1.9.2+ by running `ruby -run -ehttpd . -p8080` from your local directory
* Node.js by installing and running either
[`static -p 8080`](https://www.npmjs.org/package/node-static)
or [`http-server -p 8080`](https://www.npmjs.org/package/http-server)

A list of more complex HTTP servers can be found
[here](misc.md#servers-and-stacks).


### Why don't you automatically load the latest version of jQuery from the Google CDN?

The [file](https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js) to which
Expand Down
4 changes: 2 additions & 2 deletions src/doc/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ using some polyfill CDN service, like [cdn.polyfill.io](https://cdn.polyfill.io/
just put it before the other scripts in the bottom of the page:

```html
<script src="//cdn.polyfill.io/v1/polyfill.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://cdn.polyfill.io/v1/polyfill.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.2.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- Add your site or application content here -->
<p>Hello world! This is HTML5 Boilerplate.</p>

<script src="//ajax.googleapis.com/ajax/libs/jquery/{{JQUERY_VERSION}}/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/{{JQUERY_VERSION}}/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-{{JQUERY_VERSION}}.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
Expand Down

0 comments on commit c46ab69

Please sign in to comment.