强制外部脚本触发 onLoad
我有一个页面(page1),它将不同的页面(page2)加载到模式弹出窗口中。这个新页面(page2)有两个外部脚本,应该在页面加载时触发。如果我单独加载 AJAX 页面,那么效果很好,但是当我尝试从其他页面(page1)调用它们时,它们根本不会触发。
现在,棘手的部分是,用户将脚本插入到 CMS 中,其中包括脚本标签,而脚本实际上只是指向不同服务器 (LinkedIn) 上的外部脚本的链接。好玩好玩好玩!
无论如何,我是否可以强制这些脚本在加载时触发?
I have a page (page1), which loads a different page (page2) into a modal popup. This new page (page2) has two external scripts, which should be fired on page load. This works fine, if I load the AJAX page by itself, but when I attempt to call them from the other page (page1), they don't fire at all.
Now, the tricky part is, that the script is inserted by a user into a CMS, script tags included — and the scripts are actually just links to external scripts on a different server (LinkedIn). Fun fun fun!
Is there anyway at all I can force these scripts to fire on load anyway?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,你在这里遇到了安全问题。您不能通过 AJAX 调用不同的域,这是为了防止跨域脚本漏洞。如果像在这种情况下您无法控制外部页面(linkedin),则没有解决方案
Well you hitting a security issue here. You can not make calls via AJAX to different domains, this is to prevent cross domain scripting vulnerabilities. There is no solution if like in this case you dont have control over the external page (linkedin)