是否可以在经典网站中嵌入 Angular5 应用程序?
Is it possible to embed an Angular5 app in a classic website?
我用 Angular5 编写了一个 Web 应用程序(存储在 AWS S3 云上)。
另一家拥有传统网站的公司希望将我的 Web 应用程序的页面嵌入到他们的网站中(例如,在 iframe 中)。
可能吗?
我该怎么做?
我可以想到两个解决你问题的办法:
使用老派 iframe
。没有错:
<iframe src="https://www.yourUrl.com"></iframe>
Angular 元素。该项目基于 WebComponents 规范,可以将 Angular 应用程序编译为自定义 html-tags。查看 this excellent blog post on the topic or the respective Angular Elements documentation.
其他注意事项:
CORS
在 iframe
的情况下,您可能要考虑的一件事是 CORS, you'll have to manually allow the other companies website to include your application in your Access-Control-Allow-Origin Header。
带宽:
允许其他网站将您的应用程序嵌入 iframe
会给您的服务器带来额外流量的负担。
我用 Angular5 编写了一个 Web 应用程序(存储在 AWS S3 云上)。
另一家拥有传统网站的公司希望将我的 Web 应用程序的页面嵌入到他们的网站中(例如,在 iframe 中)。
可能吗?
我该怎么做?
我可以想到两个解决你问题的办法:
使用老派
iframe
。没有错:<iframe src="https://www.yourUrl.com"></iframe>
Angular 元素。该项目基于 WebComponents 规范,可以将 Angular 应用程序编译为自定义 html-tags。查看 this excellent blog post on the topic or the respective Angular Elements documentation.
其他注意事项:
CORS
在 iframe
的情况下,您可能要考虑的一件事是 CORS, you'll have to manually allow the other companies website to include your application in your Access-Control-Allow-Origin Header。
带宽:
允许其他网站将您的应用程序嵌入 iframe
会给您的服务器带来额外流量的负担。