如何在没有加载程序的情况下独立使用 YUI 3 History?
在我们的 SSL 页面上使用 YUI 脚本会破坏 SSL 连接,因为它们通过 http 连接动态加载来自 yahoo(组合)的脚本。
由于我们只使用 YUI 3 的历史管理器,我想将代码托管在我们的服务器上。如果我从 http://yui.yahooapis.com/combo?3.2.0/build/yui/yui-min.js&3.2.0/build/ oop/oop-min.js&3.2.0/build/dom/dom-base-min.js&3.2.0/build/dom/selector-native-min.js&3.2.0/build/dom/selector- css2-min.js&3.2.0/build/event-custom/event-custom-min.js&3.2.0/build/event/event-base-min.js&3.2.0/build/node/node- base-min.js&3.2.0/build/event/event-synthetic-min.js&3.2.0/build/json/json-min.js&3.2.0/build/history/history-min.js& 3.2.0/build/history/history-hash-ie-min.js 它不再起作用(“Y.History.getBookmarkedState 不是一个函数”,firebug 说)。
有谁知道如何正确地做到这一点?
谢谢
Using YUI scripts on our SSL page turned out to break the SSL connection because they dynamically load scripts from yahoo (combo) over a http connection.
As we only use the history manager of YUI 3, I wanted to host the code on our server. If I copy the code from http://yui.yahooapis.com/combo?3.2.0/build/yui/yui-min.js&3.2.0/build/oop/oop-min.js&3.2.0/build/dom/dom-base-min.js&3.2.0/build/dom/selector-native-min.js&3.2.0/build/dom/selector-css2-min.js&3.2.0/build/event-custom/event-custom-min.js&3.2.0/build/event/event-base-min.js&3.2.0/build/node/node-base-min.js&3.2.0/build/event/event-synthetic-min.js&3.2.0/build/json/json-min.js&3.2.0/build/history/history-min.js&3.2.0/build/history/history-hash-ie-min.js It does not work anymore ("Y.History.getBookmarkedState is not a function" says firebug).
Does anyone know how to do that correctly?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想你应该检查一下API。我检查了这个组合中的代码,它确实加载了历史记录和子模块。
它显示输出
G();
另外,我在history-deprecated
子模块中发现了getBookmarkedState
声明,因此似乎使用了新的东西来代替它。I guess you should check the API. I've checked the code from this combo and it really loads History and submodules.
It shows outputs
G();
Also I foundgetBookmarkedState
declaration insidehistory-deprecated
submodule so it seems like something new is used instead of this.您正在正确加载模块,但您正在尝试使用已弃用的 History API(来自 YUI <=3.1.x)。在 YUI 3.2.0 中,历史实用程序被重写,并且 API 不向后兼容。
您仍然可以通过加载
history-deprecated
模块而不是history
来使用 3.2.0 中的旧 API。或者(最好)您可以迁移到新的 API,它比旧的 API 更简单、更灵活。您将在历史记录实用程序文档中找到迁移指南。You're loading the modules correctly, but you're trying to use the deprecated History API (from YUI <=3.1.x). In YUI 3.2.0, the History Utility was rewritten, and the API is not backwards-compatible.
You can still use the old API in 3.2.0 by loading the
history-deprecated
module instead ofhistory
. Alternatively (and preferably) you can migrate to the new API, which is simpler and more flexible than the old one. You'll find a migration guide in the History Utility documentation.