admin管理员组文章数量:1334204
I have two web application on different domain.
- Web App1
- Web App2
My Final goal is as par below.
I have found the tutorial to login with Google account API in Asp MVC - 5.
By using same concept I am trying to do below things
Open WebApp2 from WebApp1
From WebApp2 on Apply event redirect to specified URL consist of URL + required data in encrypted format.
From WebApp1 by continuously checking for the updated URL and accordingly display the data on WebAp1.
- Close the WebApp2.
To achieve the above steps, my source code (WebApp1) as par below.
var REDIRECT = "http://localhost/Home/Test";
var webApp2 = window.open("WebApp2Url", "CrossDomain", '', true);
var pollTimer = window.setInterval(function () {
try {
if (webApp2.document.URL.indexOf(REDIRECT) != -1) {
window.clearInterval(pollTimer);
// logic to retrieve data from webApp2.document.URL
webApp2.close();
debugger;
}
}
catch (e) {
}
}, 500);
I am getting below error at code line
[if (webApp2.document.URL.indexOf(REDIRECT) != -1) {]
DOMException: Blocked a frame with origin "http://localhost" from accessing a cross-origin frame.
Please any one can guide me to resolve above error.
I have tried with enabling CORS in WebApp2 but it didn't work.
Any idea to design WebApp2 is highly wele.
I have two web application on different domain.
- Web App1
- Web App2
My Final goal is as par below.
I have found the tutorial to login with Google account API in Asp MVC - 5.
https://tutorialslink./Articles/How-to-login-with-Google-account-API-in-Aspnet-MVC---5/18
By using same concept I am trying to do below things
Open WebApp2 from WebApp1
From WebApp2 on Apply event redirect to specified URL consist of URL + required data in encrypted format.
From WebApp1 by continuously checking for the updated URL and accordingly display the data on WebAp1.
- Close the WebApp2.
To achieve the above steps, my source code (WebApp1) as par below.
var REDIRECT = "http://localhost/Home/Test";
var webApp2 = window.open("WebApp2Url", "CrossDomain", '', true);
var pollTimer = window.setInterval(function () {
try {
if (webApp2.document.URL.indexOf(REDIRECT) != -1) {
window.clearInterval(pollTimer);
// logic to retrieve data from webApp2.document.URL
webApp2.close();
debugger;
}
}
catch (e) {
}
}, 500);
I am getting below error at code line
[if (webApp2.document.URL.indexOf(REDIRECT) != -1) {]
DOMException: Blocked a frame with origin "http://localhost" from accessing a cross-origin frame.
Please any one can guide me to resolve above error.
I have tried with enabling CORS in WebApp2 but it didn't work.
Any idea to design WebApp2 is highly wele.
Share Improve this question edited Dec 16, 2019 at 3:03 sideshowbarker♦ 88.4k29 gold badges215 silver badges212 bronze badges asked Aug 13, 2018 at 8:05 DeveloperSDDeveloperSD 3162 gold badges3 silver badges22 bronze badges1 Answer
Reset to default 0I have got the work around for the same.
In my WebApp2 After finishing with processing I am redirect control to my WebApp1 i.e to domain1.
Reference:
How do I get around window.opener cross-domain security
本文标签:
版权声明:本文标题:javascript - DOMException: Blocked a frame with origin "http:localhost" from accessing a cross-origin frame - 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742258969a2442156.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论