Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm craeting a website with 2 frames,one of them contains google.com and other with localhost application

This is the error im getting in Google console:

Unsafe JavaScript attempt to initiate navigation for frame with URL 'http://localhost:5199/default.aspx' from frame with URL 'https://www.google.co.in'. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.

Uncaught SecurityError: Blocked a frame with origin "http://google.co.in" from accessing a frame with origin "http://localhost:5199". Protocols, domains, and ports must match.

Can someone help me how to solve this error

Thanks in advance.
Posted
Comments
F-ES Sitecore 31-Mar-15 17:53pm    
Google has javascript on it that stops it being viewed in an iframe.
Raghu S Gowda 1-Apr-15 0:57am    
Thanks for ur info.

1 solution

You can also fix the CORS origin request error by adding this code in Global.asax file.

C#
protected void Application_BeginRequest(object sender, EventArgs e)
        {

            // enable CORS
            HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "https://www.google.co.in");

        }
 
Share this answer
 
Comments
Raghu S Gowda 1-Apr-15 0:59am    
Thanks Prusty.
but i don have global.aspx page since i have created an empty website.
Sudhansu Sekhar Prusty 1-Apr-15 1:18am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900