授予对外部站点的位置访问权限 [英] grant access to Location to framed external site

查看:53
本文介绍了授予对外部站点的位置访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对外部网站进行 iframe.该站点出于分析原因尝试从父级调用位置,但访问被拒绝(出于明显的默认安全原因).但是我想禁用该安全性和答案,因为该站点是'朋友',但不在同一个域中.似乎不可能授予该访问权限...知道吗?

I'm iframing an external site. That site tries to call location from parent for analytics reasons and access is refused (for obvious default security reasons) . Yet I would like to disable that security and answer, because that site is a 'friend' but not on the same domain. Seems impossible to grant that access... any idea ?

推荐答案

我之前也遇到过类似的情况.允许通过 iframe 进行跨域 javascript 访问是不可能的,因为这会导致跨脚本攻击的噩梦.就像另一张海报说的那样,您必须自己将这些数据发布给他们.解决此问题的一种方法是设置一个 cookie,其他域可以使用他们正在寻找的任何信息读取该 cookie,然后他们可以从 cookie 中读取数据.当您在 iframe 中加载其他站点时,Javascript 可以设置为 cookie.对于执行此操作的函数,请检查 http://phpjs.org/functions/setcookie:509

I ran into a similar situation before. Allowing for cross domain javascript access through iframes is not possible since this would result in a cross-scripting-attack nightmare. Like the other poster said, you will have to post this data to them yourself. One way to fix this is to set a cookie that can be read by the other domain with whatever information they are looking for then they can read the data from the cookie. Javascript can set to the cookie when you load the other site in the iframe. For a function to do that, check http://phpjs.org/functions/setcookie:509

这篇关于授予对外部站点的位置访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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