Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the reason to include scripts with two different calls?

I use HTML5 boilerplate and jQuery is declared twice in the HTML page like this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>

What's the reason behind including the JavaScript files this way?

It seems to be the only reason is to load jQuery library from local server if it's not reachable from Google CDN.

like image 504
Sergei Basharov Avatar asked Jan 03 '12 18:01

Sergei Basharov


People also ask

What is the importance of having a script in taking telephone inquiries?

The use of a script will give uniformity to the calls that take place in your call center. Especially in reference to customer service scripts, one of the main benefits is to promote consistency across the call center. When a customer calls in with an issue, you can be sure that each agent will handle it the same way.

What is a calling script?

A call script, a written script entailing correct wording and logic aids, assists an agent in handling a contact. It also assists in the maintenance of focusing on the content of the contact.

How do you cold call an effective script?

Example of Cold Calling ScriptHello [prospect name]. This is [name] from [company]. (pause) Do you have two minutes to chat? (prospect says yes) Great, thank you. We're a [describe company] platform that helps companies like yours [problem you solve].

What is the important for effective speech during a cold call?

Be specific. Just like a pitch that comes too early can scare off a potential lead, being too vague in your message can also risk a lead. Be clear and concise in speaking with your prospect and be specific about how your product or service can be of value to them.


3 Answers

They reason html5 Boilerplate includes the script that way is because it attempts to "load jQuery library from local server if it's not reachable from Google CDN." =)

like image 106
Ayman Safadi Avatar answered Sep 21 '22 21:09

Ayman Safadi


<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

This will attempt to load the protocol-less version of the jQuery library

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

This will load the local version of the jQuery library if the google-hosted version was not loaded properly (unreachable, site is down, etc), hence the window.jQuery check. If window.jQuery is not true then it will execute the document.write

like image 27
hunter Avatar answered Sep 20 '22 21:09

hunter


Loading jQuery from the Google CDN can be much faster than loading it from your local server and it can be cached so the user might already have a cached copy of it from another website.

The check is make sure that it got loaded, otherwise if it failed, load it from the local server.

like image 38
letuboy Avatar answered Sep 22 '22 21:09

letuboy