请求访问的帧具有“https”协议,正被访问的帧具有“http”协议。协议必须匹配 [英] The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match

查看:603
本文介绍了请求访问的帧具有“https”协议,正被访问的帧具有“http”协议。协议必须匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出现此错误:

未捕获SecurityError:阻止了具有原点的框架 https://lss-servicedesk.techteam.com 访问源文件框架中的
http://mydomain.com

请求访问的帧具有https协议,被访问的帧具有协议http。
协议必须匹配。

 < FORM ACTION = https://lss-servicedesk.techteam.com/CAisd /pdmweb.exe METHOD = POST onsubmit =return checkform(this);> 

有没有办法解决这个问题?在此先感谢...

解决方案

您在这里收到2个错误。第一个问题是跨域问题,您无法解决这个问题。您的网站无法访问加载的iframe网站。否则,浏览器会非常不安全,只需加载一个iframe就可以让一个站点很容易地在另一个站点上获取用户的设置。所以,你不能在iframe中改变任何东西。您可以对iframe的内容做的唯一事情是: iframeElement.src ='//otherurl.com'; - 更改iframe的源网址。



要解决第二个问题,您可以执行以下操作:而不是使用 http:// https :// 在你的脚本或表单中定义的url中,你可以使用 // 。这将自动填写与您现在使用的协议相同的协议。因此,如果您目前位于 http:// ,它将加载 http:// ,反之亦然。


I'm getting this error :

Uncaught SecurityError: Blocked a frame with origin "https://lss-servicedesk.techteam.com" from accessing a frame with origin "http://mydomain.com".
The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match.

<FORM ACTION=https://lss-servicedesk.techteam.com/CAisd/pdmweb.exe METHOD=POST onsubmit="return checkform(this);">

Is there any way to get around this problem ? thanks in advance...

解决方案

You're getting 2 errors here. The first one is a cross-domain problem, and you won't be able to fix that. It is impossible for your site to access the loaded iframe's site at all. Otherwise, the browser would be really insecure, allowing one site to very easily get the user's settings on another site by just loading an iframe. So, you can't change anything within the iframe. The only thing you can do to the iframe's contents is iframeElement.src = '//otherurl.com'; - changing the source url of the iframe.

To fix the second problem, you can do the following: Instead of using http:// or https:// in the url you're defining in your scripts or forms, you can just use //. That will automatically 'fill in' the same protocol as the one you're using now. So, if you're on http:// at the moment, it'll load the iframe in http:// too, and vice versa.

这篇关于请求访问的帧具有“https”协议,正被访问的帧具有“http”协议。协议必须匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆