Recaptcha Uncaught SecurityError: Blocked a frame with origin “https://www.google.com”

偶尔善良 提交于 2019-12-24 15:13:14

问题


I am using recaptcha 2nd version.After posting form date with ajax to server i am getting

"Uncaught SecurityError: Blocked a frame with origin "https://www.google.com" from accessing a frame with origin "http://localhost:14656". The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match." error.

In layout added script as src='//www.google.com/recaptcha/api.js' async defer

I am using ASP MVC 4.0 for project.

Could you help me?


回答1:


In your layout script change the src to http://www.google.com/recaptcha/api.js

The error occurs because your src is running on https and your web app on http.




回答2:


Try this:

<script src='https://www.google.com/recaptcha/api.js'></script>

and use:

<div class="g-recaptcha" data-sitekey="YOUR SITE KEY"></div>


来源:https://stackoverflow.com/questions/29578250/recaptcha-uncaught-securityerror-blocked-a-frame-with-origin-https-www-googl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!