cdn

vue-cli3项目中使用CDN

*爱你&永不变心* 提交于 2019-12-05 14:00:33
1、html 中引入 echarts html中添加script标签如下: <script src="//cdn.bootcss.com/echarts/4.2.1/echarts.simple.min.js"></script> 2、在 webpack 中配置使用 echarts CDN   在vue.config.js中配置如下:    module.exports = {     configureWebpack: {       externals: {         'echarts': 'echarts' // 配置使用CDN       }     }    }   externals中的key是用于import,value表示的在全局中访问到该对象,就是window.echarts 3、在vue文件中使用   在vue中使用echarts的时候无需 import echarts,可直接使用 来源: https://www.cnblogs.com/ivan5277/p/11926547.html

require js loading scripts from cdn fail

孤者浪人 提交于 2019-12-05 12:32:43
I am new to RequireJS, and for some reason I cannot load scripts through a CDN. My code: // site full url var siteUrl = window.location.protocol+"//"+window.location.host + "/fresh/"; // requirejs config requirejs.config({ baseUrl: siteUrl + "assets/js/", paths: { "plugins": "plugins", "scripts": "scripts", "jquery": "https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min", "jquery-ui": "https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min", "bootstrap": "https://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min", } }); require(['jquery', 'jquery-ui',

Use CloudFlare to CDN a Google Cloud Storage Bucket

痞子三分冷 提交于 2019-12-05 09:17:30
I've heard many good things about Cloudflare, and they have an excellent CDN product that features functionality not found on competitors (HTTP2, IPv6 etc). I have files in a Google Cloud Storage bucket. How to set these files as the origin for a Cloudflare CDN? (The Cloudflare control panel seems to just want a website on a root domain...?) Maybe a bit late, but I put my answer just in case it is useful for someone else looking to do the same thing. I have a bucket in Google Cloud Storage behind CloudFlare. You just need to follow the instructions here: https://cloud.google.com/storage/docs

IE 11 fails to load resource files

 ̄綄美尐妖づ 提交于 2019-12-05 08:24:47
I have an application employing FontAwesome's glyph fonts for icons, and everything works fine when I host the files from my server. When I enable CDN support on my site, IE 11 behaves rather strangely in regards to the font files. When navigating to a page either via clicking a link or manually entering a URL, the font files load fine ~95% of the time. If I reload a page or use forward/back buttons (or the ~5% of the time a normal page load doesn't work), IE 11 loads the first font file, loses/drops/ignores the contents of the response body somehow, tries to load the second file, loses the

Is it bad to hotlink jQuery from jquery.com?

孤街醉人 提交于 2019-12-05 07:29:11
This will probably get a pretty nasty response, but my server isn't the fastest at the moment, and my site loads much faster if I hotlink from the jQuery homepage so they server the content. Is this bad to do? Does jQuery eventually remove those js files from their page? Better hotlink it from Google API libraries . Very big advantages: Google is fast and highly available Separate hosts, allows the client to load JQuery simultaneously with your pages and images (browsers support only a limited number of connections per host) Probably even faster still, because many websites use it, so this

How to serve GWT static files from a CDN

♀尐吖头ヾ 提交于 2019-12-05 07:16:39
问题 I am trying to figure out how to serve my GWT files from a CDN instead of from a tomcat server. I started with this code <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="robots" content="no-index, no-follow" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>My Site</title> <script type="text/javascript" src="/bcmjs/bcmjs.nocache.js"></script> </head> <body> <div

How can I run a fallback copy of jQuery after the DOM is loaded?

橙三吉。 提交于 2019-12-05 04:54:47
问题 The following are the first lines of code in a <script> tag just above the closing body tag in my document (it specifies that a locally-served copy of jQuery is run in the event that Google's CDN fails): if(!window.jQuery){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = '/js/jquery.js'; var scriptHook = document.getElementsByTagName('script')[0]; scriptHook.parentNode.insertBefore(script, scriptHook); } jQuery(document).ready(function($){ // page

Why doesn't Facebook combine its CSS/JS files?

那年仲夏 提交于 2019-12-05 00:40:34
问题 I am curious as to why the Facebook developers have chosen to not combine their scripts and stylesheets into single files. Instead they are loaded on demand via their CDN. Facebook is obviously a very complex application and I can understand how such modularity might make Facebook easier to maintain, but wouldn't the usual optimisation advice still apply (especially given its high level of usage)? Or, does the fact that they are using a CDN avoid the usual performance impact of having lots of

一招搞定服务器在国外,国内视频访问不了问题

你说的曾经没有我的故事 提交于 2019-12-05 00:26:13
在国内,服务器放国外的平台有不少,我们公司就是,有些视频资源就是一直放国外,不知道为啥,但访问速度确实不行,最近就在处理这个问题,发现了个小窍门,在这里跟大家分享一下: 我们公司用的CDN是猫云的,访问速度提升了不少,但有时候还是会出问题,比如下面这个: 视频打不开了~~~ 吓得我赶紧跟猫云的技术沟通,问咋回事: 处理完以后~~~ 很快就可以播放了,猫云的技术说,出这种情况主要是我把域名解析到服务器的IP上,直接跳到源站导致的。 优化方案主要有两步,第一步就是看有没有解析到cname,就是在添加加速域名的时候,把原来的A记录替换成cname。 第二步就是让CDN服务商优化一下回源链路。这个原理很简单,就是原来的链路可能是从美国节点到澳洲节点再到日本节点再到中国;优化后,链路可能变成美国节点到日本节点再到中国,这样物理距离近了,访问速度也就快了。 重点说下优化一下链路,这个需要CDN服务商去操作,猫云这边的技术支持还比较及时,不用走工单,所以还比较方便。 总之,是个使用CDN过程中的一点经验,希望在用CDN的童鞋别再犯这种错误。 来源: https://www.cnblogs.com/maocloud/p/11891184.html

How to prevent exposing origin IP address on Cloudflare?

£可爱£侵袭症+ 提交于 2019-12-04 23:09:39
On Cloudflare DNS setting page it state that An A, AAAA, CNAME, or MX record is pointed to your origin server exposing your origin IP address. I have an MX record on my domain pointing to mail.mydomain.com . I believe it is something needed for the mail to work. How can I prevent it from exposing my origin IP address? CloudFlare forwards your traffic through their network by replacing the IP in DNS records with CloudFlare's IP. This process works well in all situation except mail servers. CloudFlare does not offer any service for forwarding mail and as such when you take a MX record and point