Firefox OS特权应用程序:权限被拒绝访问创建的新窗口对象的属性“文档” [英] Firefox OS privileged app: Permission denied to access property 'document' of new window object created

查看:173
本文介绍了Firefox OS特权应用程序:权限被拒绝访问创建的新窗口对象的属性“文档”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Firefox OS特权应用程序中,我需要使用Google进行身份验证。

  uri = https://accounts.google.com / o / oauth2 / auth ............ 

var googleWin = window.open(uri,'auth_window','fullscreen = 0,width = 200,height = 100,可调整大小= 1' );


console.log(googleWin.document.title);

试图打印文档标题的上述语句导致错误

 错误:权限被拒绝访问属性'document'

我需要从文档标题访问Google authcode。

如何解决权限问题?

在此先感谢。

解决方案

因为同一来源安全政策,您将无法访问该窗口的DOM。在文档中,他们建议您使用AJAX 与您的认证码并处理该请求。


In my Firefox OS privileged app I need authentication with Google.

uri=https://accounts.google.com/o/oauth2/auth............

var googleWin = window.open(uri, 'auth_window', 'fullscreen=0,width=200,height=100,resizable=1');


console.log(googleWin.document.title); 

The above statement which try to to print the document title result in error

Error: Permission denied to access property 'document'

I need to access the Google auth "code" from the document title.

How to solve the permission problem?

Thanks in advance.

解决方案

Because of the same origin security policy, you're not going to be able to access that window's DOM. In the documentation, they suggest using AJAX with your auth code and processing the response of that request.

这篇关于Firefox OS特权应用程序:权限被拒绝访问创建的新窗口对象的属性“文档”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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