跨服务器 iframe 事件监听器
对于基于 Firefox 的信息亭系统,我使用 iframe 来包含客户端的网站。事实证明 Windows 7 键盘的性能非常糟糕,因此他要求使用 javascript 屏幕键盘。
就目前情况而言,我无法通过 onclick 事件侦听器访问网站输入元素来显示键盘并添加字符,因为 Firefox 强制执行同源策略。
还有其他可能性如何完成该任务吗?
For a Firefox-based kiosk system I’m using an iframe to include the website of the client. The Windows 7 keyboard proves to perform very bad, so he asked for an javascript on-screen keyboard.
As it stands now, I can’t access the websites input elements via an onclick event listener to show the keyboard and add the characters, as Firefox enforces a same-origin policy.
Are there any other possibilities how to tackle that task?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不同来源的窗口之间唯一真正的跨浏览器交互是通过更改哈希值,您可以使用 JavaScript 对此做出反应。但这意味着您的客户也必须实现一个脚本。
还有其他可能破坏同源策略(例如 postMessage),但如果不对两个网站进行调整,则没有一个可以开箱即用。
the only real crossbrowser interaction between windows of not the same origin is by chaning the hash, on which you can react to with javascript. But it would mean, that your client would have to implement a script as well.
There are other possibilities to break the same origin policy (like postMessage) but none works out of the box without tweaks to both websites.
您可以使用 Greasemonkey 还是您需要离开 Firefox ?通过这种方式,您可以将 Greasemonkey 设置为运行可以与所有站点交互的本地脚本。
Is it possible for you to use Greasemonkey or do you need to leave Firefox alone? This way you can set Greasemonkey to run local scripts that can interact with all your sites.