123456789101112131415161718 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Load jQuery if Zepto is not supported</title>
- </head>
- <body>
- <h1>Load jQuery if Zepto is not supported</h1>
- </body>
- <script>document.write('<script src='+('__proto__' in {} ? '../dist/zepto' : 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery')+'.js><\/script>')</script>
- <script>
- $('body').append('<p>Hello from '+('Zepto' in window ? 'Zepto' : 'jQuery')+'!</p>')
- $('script').each(function(index,script){
- if (script.src)
- $('<p><script src="'+script.src+'"></p>').appendTo('body')
- })
- </script>
- </html>
|