snipt

Type "h" for KB shortcuts
spacer

Building things is hard.

Issue tracking shouldn't be. Sifter makes it simple.

snipt Pro Get exclusive interface features and professional blogging tools.
#8835

HTML

Load jQuery even if the Google CDN is down

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<script type="text/javascript" src="/img/spacer.gif"> "ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
	// Ensure that jQuery is installed even if the Google CDN is down.
	if (typeof jQuery === "undefined") {
		var script = document.createElement('script');
		var attr = document.createAttribute('type');
		attr.nodeValue = 'text/javascript';
		script.setAttributeNode(attr);
		attr = document.createAttribute('src');
		attr.nodeValue = '/scripts/jquery-1.3.2.min.js';
		script.setAttributeNode(attr);
		document.getElementsByTagName('head')[0].appendChild(script);
	}
</script>
  • pdokas
  • 3 years, 5 months ago
  • Raw / Raw Nice
  • Tweet
×

Copy “Load jQuery even if the Google CDN is down”

(Text is selected. +C to copy.)

×

Embed “Load jQuery even if the Google CDN is down”

(Text is selected. +C to copy.)

https://snipt.net/embed/7651df65a75f62336a80cb82fce4b4cf/
https://snipt.net/raw/7651df65a75f62336a80cb82fce4b4cf/
7651df65a75f62336a80cb82fce4b4cf
html
HTML
14
2013-03-19T13:35:01
True
False
/api/public/snipt/8835/
load-jquery-even-if-the-google-cdn-is-down
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="special"> 1</span> <span class="special"> 2</span> <span class="special"> 3</span> <span class="special"> 4</span> <span class="special"> 5</span> <span class="special"> 6</span> <span class="special"> 7</span> <span class="special"> 8</span> <span class="special"> 9</span> <span class="special">10</span> <span class="special">11</span> <span class="special">12</span> <span class="special">13</span> <span class="special">14</span></pre></div></td><td class="code"><div class="highlight"><pre><a name="line-1"></a><span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">src="/img/spacer.gif">
html, javascript, jquery
spacer
×

Keyboard shortcuts

Key Function
h Show / hide keyboard shortcuts
/ Focus search field
esc Unfocus search field / deselect snipt
j Next snipt
k Previous snipt
o / return Go to snipt
u Go to snipt's author
e Expand / collapse snipt
v Embed snipt
c Copy snipt
<ctrl-e> Edit snipt
<ctrl-delete> or <ctrl-backspace> Delete snipt
<ctrl-n> or <alt+n> Add new snipt
<ctrl-s> Save snipt
<ctrl-c> Save snipt and close
n Next page
p Previous page
g Scroll to top of page
G Scroll to bottom of page
<ctrl-h> Back
<ctrl-l> Forward
t Open new window/tab
r Refresh page
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.