开发可重用的html组件 [英] Developing reusable html components

查看:114
本文介绍了开发可重用的html组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一套HTML组件,这些组件可以在我们的许多业务合作伙伴(内部和外部做我们的域)开发的一组应用程序中重复使用。例如,我想开发一个'图形'小部件,它负责关于检索数据,绘制图表等所有细节。然后,业务合作伙伴可以引用这个组件并将其嵌入到他们的Web应用程序中。我在逻辑上把这看作是能够链接到组件的合作伙伴,并且组件返回之间的所有细节。传统的做法是利用IFrames,但我们不希望将这种方法用于内部原因。

是否有现有的框架允许这样做?
我知道所有的XSS,如果我使用CORS,似乎可以做。是否还有其他安全性(或其他方面)需要注意?



简单地说,问题是否有客户端可以向我发送http呼叫的方式服务,我的服务返回HTML片段(包括呈现html所需的任何必需的css / js)。



预先感谢。

解决方案

不可能; HTML仅仅是一种标记语言,并且是不可扩展的。



然而,XHTML 可扩展的(参见:使用定义和扩展模块开发DTD )。

您也可以使用CSS和/或JavaScript文件(您的业务合作伙伴可以参考< link> < script> 元素),它们可以修改普通HTML的外观(CSS)和行为(JS)。有许多库已经使用了这些技术,您可能会使用这些技术。例如, Kendo 可以将您的普通HTML元素转换为功能丰富的元素。


I would like to development a set of HTML components that can be reused across a set of applications developed by many of our business partners (both internal and external do our domain). For example, I would like to develop a 'graph' widget that takes care of all the details around retrieving data, plotting on a chart and so on. Then a business partner can 'reference' this component and embed it within their web application. I logically visualize this as the partner being able to link to the component and the component returns with all the details in between. Traditional ways of doing this leveraged IFrames but we do not want to utilize this approach for internal reason.

Are there existing frameworks that allow that allow this? I'm aware of all the XSS and it seems it's possible to do if I leverage CORS. Are there other security (or other aspects) I need to be aware of?

To simply the question, is there a way a client can make an http call out to my service, and my service returns HTML fragment (including whatever required css/js needed to render the html).

Thanks in advance.

解决方案

With pure HTML, this is not possible; HTML is simply a markup language, and is not extensible.

However, XHTML is extensible (see: Developing DTDs with defined and extended modules).

You could also utilize CSS and/or JavaScript files (which your business partner could reference with <link> and <script> elements, respectively), which could modify the appearance (CSS) and behavior (JS) of normal HTML. There are a number of libraries using these techniques already which you could potentially use. For example, Kendo can transform your "normal" HTML elements into something feature-rich.

这篇关于开发可重用的html组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆