最佳实践 - MOSS 07 和 Javascript 文件?
在 MOSS 2007 中使用 javascript 文件的建议方法是什么? 12 Hive 中的某处或直接在站点的虚拟目录中的脚本目录中? 或者可能作为 Web 部件中的嵌入式资源?
What are the suggested methods for using javascript files with MOSS 2007 ? in the 12 Hive somewhere or directly in the site's virtual directory in a scripts directory ? Or possibly as a embedded resource in a webpart ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
就我个人而言,这完全取决于 JavaScript 文件的用途。 如果它们要在多个组件之间共享,那么我建议将它们放置在 12-hive 中。 但是,如果它们将被隔离到单个组件(例如 Web 部件),那么将它们作为资源嵌入也可以。
本文讨论了您可能会发现部署 Web 部件资源的最佳实践很有用,总结如下:
Personally, it all depends on what purpose the JavaScript files are going to serve. If they're going to be shared amongst multiple components then I would suggest placing them in the 12-hive. If however, they're going to be isolated to a single component - a web part for instance - then embedding them as a resource will work as well.
This article has a discussion about best practices for the deployment of web part resources which you may find useful, in concludes:
我建议您将这些脚本部署在 12-hive 中。
I suggest you deploy these scripts in the 12-hive.
我的添加到 Sharepoint Designer 中一个名为“脚本”的文件夹中,我认为这会将其放入数据库中。
Mine where added to Sharepoint Designer in a folder I called "scripts" I think that puts it in the database.
我们使用单独的脚本目录。
我们对图像使用类似的方法。
这使我们能够在 Web 部件和可通过 Sharepoint 访问的自定义应用程序之间轻松共享图像和 Javascript。
这也意味着它们只被下载一次并被缓存。
We use a seperate scripts directory.
We use a similiar approach to images.
This allows us to share images and Javascript easily between our webparts, and custom applications which are available though Sharepoint.
This should also mean they're only downloaded once, and cached.