B
B
Bob Smith2013-02-20 20:16:07
JavaScript
Bob Smith, 2013-02-20 20:16:07

How to work with window.open in firefox (does not give access to the parent window)?

I do OAuth authorization from social networks, through a popup window in which a page opens https://sitename.ru/Account/RegisterVkthat requests information from a social network using the AOAuthNET library . The popup opens like this:

var params = 'menubar=no,location=yes,resizable=no,scrollbars=no,status=no,width=900,height=500',
win = window.open(url, name, params);

In social networks, the address for the result is indicated https://sitename.ru/Account/RegisterVkResult, which receives a code to access user data, authorizes it and prescribes a cookie, and then returns a page with a script of the following content:
window.opener.LogOnSuccess('OK');
window.close();

All URLs in all scripts are spelled out in full, starting with https://sitename.ru(without www).
The site runs on IIS 7.5 with Module Rewrite installed, which redirects from http to https and from www.sitename.ruto sitename.ru
The actual problem: in all browsers, except for firefox, this code works fine, calls the parent window's LogOnSuccess method (which updates the parent page) and closes the popup . But Firefox does not give access, believing that the request comes from another domain. Rummaged through a bunch of options - all to no avail. Tell me, what is the jamb and where to dig?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
Bob Smith, 2013-02-21
@bob_smith

The problem was solved with an incomprehensible crutch:
If on the page in the pop-up, before calling window.opener, you call a redirect to itself (that is, just document.location = 'https://sitename.ru/Account/RegisterVkResult'), then access appears.
If anyone can explain the reasons for this phenomenon, I would be extremely grateful.

C
creage, 2013-02-20
@creage

parent.window.opener ?

L
lubezniy, 2013-02-20
@lubezniy

In theory, in the direction of the crossdomain.xml files and the document.domain property.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question