Skip to content
This repository has been archived by the owner on Jan 14, 2018. It is now read-only.

https prefix for jQuery from CDN, and commented out GA snippet #39

Closed
wants to merge 1 commit into from
Closed

https prefix for jQuery from CDN, and commented out GA snippet #39

wants to merge 1 commit into from

Conversation

FrancescoRizzi
Copy link
Contributor

I've added the "https" prefix to the references to jQuery from google CDN (without it, you'd get an error when serving the pages on the file:// protocol)

I've also wrapped the GA snippets in comments, because they'd lead to errors until one enters their own GA ID.

Not sure if these are scenarios you are targeting, but they were the only two errors "out of the box" left for me. Hopefully a user can now grab the zip from github, unzip and open index.html and get no errors. HTH

… CDN (this avoids an issue when serving the pages through file:// protocol.

Also, wrapped GA sniplets in comments, to avoid another error until one enters their own GA ID.
@martinbean
Copy link

It's preferable to drop the protocol, as in some browsers requesting securing content from a non-secure URL causes, "This page contains both secure and non-secure items. Do you wish to proceed?" prompts on page load.

The preferable solution would be to either use a localhost (where your web pages would then be accessible via HTTP), or serve a copy of jQuery on your machine when jQuery's not available over HTTP, with something like:

<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.7.2.min.js"><\/script>')</script>

Which is what's used in the HMTL5 Boilerplate.

@FrancescoRizzi
Copy link
Contributor Author

I agree with martinbean's comments, of course. I guess that's what I meant by "Not sure if these are scenarios you are targeting". Perhaps index.html could have the protocol prefix, while example.html could be without?

OR clearly indicate to the user that the pages are setup to be served by a web server (and may require tweaking otherwise).

OR we could use http instead of https (which should get us around the "secure/unsecure content" browser warning - I did a quick check and that seems fine for Chrome, but would be worth checking in other browsers as well, of course.

Thoughts? Thanks

@malarkey
Copy link
Owner

I think I’ll stick with the HTML5 Boilerplate approach of:

<script>window.jQuery || document.write('<script src="js/jquery-1.7.2.min.js"><\/script>')</script>

@malarkey malarkey closed this Apr 27, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants