Click the link in the web page framework and report an error: Uncaught DomException Blocked a frame with origin from accessing a cross-origin frame
1. Click the link in the web page frame and report an error: Uncaught DomException: blocked a frame with origin “https://cmcp.cmc.tianyirm.cn” from accessing a cross-origin frame. at todetail (https://cmcp.cmc.tianyirm.cn/sub-sites:253:19),如图1
2. Click at Todetail (http://cmcp.cmc.tianyirm.cn/sub-sites:253:19)View, as shown in Figure 2
parent.$RouterTo
Uncaught DOMException: Blocked a frame with origin "https://cmcp.cmc.tianyirm.cn" from accessing a cross-origin frame.
3. Carefully analyze the reasons. The same-origin policy prevents the script from accessing the content of the website from different sources. The URL is:https://console.cmc.tianyirm.cn, the framework is:https://scmcp.cmc.tianyirm.cn, but the link to open is:http://web.cmc.tianyirm.cn, adjust parent.$routerTo to window.$routerto, as shown in Figure 3
function toDetail(id,siteId){
if(window.$RouterTo){
window.$RouterTo('#terrace/detail/?id='+id+'&select_site='+siteId+'&type_site=1');
}else{
location.href = '/Terrace/detail?id='+id+'&select_site='+siteId+'&type_site=1'
}
}
function redirectToSubstation(node){
var flag=$(node).attr('flag');
var select_time=$('#select_time').val();
if(node==undefined){
flag=$('#select_type').val();
}else{
flag=$(node).attr('flag');
}
var select_site=$('.right--content .left-menu').find('li.active').parent('ol').attr('siteid');
var select_catalogId=$('.right--content .left-menu').find('li.active').attr('cataid');
if(window.$RouterTo){
window.$RouterTo("#terrace/substation/?flag="+flag+'&select_time='+select_time+'&select_site='+select_site+'&select_catalogId='+select_catalogId);
}else{
location.href = '/Terrace/substation?flag='+flag+'&select_time='+select_time+'&select_site='+select_site+'&select_catalogId='+select_catalogId;
}
}
4. Click the link in the web page frame, you can already open it normally:http://web.cmc.tianyirm.cn, as shown in Figure 4



