Reputation: 17
I have been trying to fix this for quite some time now: I can't access the url of the window because it's on another domain.. Some solutions?
function login() {
var cb = window.open(_url, "windowname1", 'width=800, height=600');
var pollTimer = window.setInterval(function() {
if (cb.document.url.indexOf(REDIRECT) >= 0) {
window.clearInterval(pollTimer);
var url = cb.document.url;
acToken = gup(url, 'access_token');
tokenType = gup(url, 'token_type');
expiresIn = gup(url, 'expires_in');
cb.close();
validateToken(acToken);
}
}, 100);
}
Upvotes: 0
Views: 320
Reputation: 3612
Do you have control over the content of _url?
In that case you can let it return it's content via javascript with document.write
and then include it on your current page by referencing it via <script type="text/javascript" src="_url" />
After this, you can access the content of _url through the DOM as you like.
Upvotes: 0
Reputation: 21
I had the same problem with IE9 and I found the solution : add try{} catch{} and increase the time of the pollTimer giving :
function login() {
var cb = window.open(_url, "windowname1", 'width=800, height=600');
var pollTimer = window.setInterval(function() {
try {
if (cb.document.url.indexOf(REDIRECT) >= 0) {
window.clearInterval(pollTimer);
var url = cb.document.url;
acToken = gup(url, 'access_token');
tokenType = gup(url, 'token_type');
expiresIn = gup(url, 'expires_in');
cb.close();
validateToken(acToken);
}
} catch (e) {
}
}, 500);
}
Upvotes: 2
Reputation: 919
No, no solution for crossdomain policy hijacking. Here some quick overview from mozilla developer.
If you explain what exactly you have to do with the document.url
property from the other domain maybe someone founds a workaround.
Upvotes: 0