[英]load custom javascript in share at every page in Alfresco 5.0
I have been trying to load a custom javascript to be loaded in all my alfresco pages. 我一直在尝试加载要在我的所有露天页面中加载的自定义javascript。
I need to add a listener, so an external application can access the current url loaded at alfresco using an iframe. 我需要添加一个侦听器,以便外部应用程序可以使用iframe访问露天安装的当前URL。
The listener would be something like this: (copied from this question ) 侦听器将是这样的:(从此问题复制)
window.addEventListener('message', function(event) {
// IMPORTANT: Check the origin of the data!
if (~event.origin.indexOf('http://yoursite.com')) {
// The data has been sent from your site
// The data sent with postMessage is stored in event.data
console.log(event.data);
} else {
// The data hasn't been sent from your site!
// Be careful! Do not use it.
return;
}
});
It can be either appended at every page or loaded as an external .js file. 它可以附加在每个页面上,也可以作为外部.js文件加载。
Thanks for your time. 谢谢你的时间。
First, check the Alfresco documentation . 首先,检查Alfresco 文档 。
For the target, you can choose either the footer or header regions. 对于目标,可以选择页脚或页眉区域。
Then in your extension, include your js file with the @script markup. 然后在您的扩展程序中,将带有@script标记的js文件包括在内。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.