如何在 WordPress 中添加最初从 Internet 加载的备份 javascript 文件
我相信你们都知道从 google 加载 jquery 之类的文件。我正在尝试以类似方式加载文件,但我想在我的服务器上备份该文件,以防在线版本关闭,而且我不知道如何在 WordPress 中执行此操作。
这是我目前从 url 加载的内容
wp_deregister_script('html5shiv');
wp_register_script('html5shiv', ("http://html5shim.googlecode.com/svn/trunk/html5.js"),false);
wp_enqueue_script('html5shiv');
I'm sure you're all aware of loading files like jquery off google. I'm trying to load a file similarly, but I want to have a backup of that file on my server incase the online version is down, and I don't know how to go about that in Wordpress.
Here's what I have currently which loads it from the url
wp_deregister_script('html5shiv');
wp_register_script('html5shiv', ("http://html5shim.googlecode.com/svn/trunk/html5.js"),false);
wp_enqueue_script('html5shiv');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这个 就是您正在寻找的。
C&P,以防有人稍后回来寻找此内容并且该网站不可用:
I think this is what you are looking for.
C&P in case someone came back later looking for this and the site is unavailable:
我不熟悉 Wordpress 排队系统,但这里有一些带有后备功能的 javascript 通用代码。您可能想将此问题发布到 http://wordpress.stackexchange.com,其中 WP api 问题往往会得到更好的答案。这是一个后备机制
I'm not familiar with the Wordpress queuing system, but here is some general code for javascript with fallback. You may want to post this question at http://wordpress.stackexchange.com where WP api questions tend to get better answers. Here is a fallback mechanism