跨子域 iframe 和 JavaScript [英] Cross sub domain iframes and JavaScript

查看:23
本文介绍了跨子域 iframe 和 JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个 CMS 网站上工作,其域是:

I am working on a CMS site whose domain is:

http://www.acmssite.com

他们有一个子域,用于存储表单系统:

They have a sub-domain where they store a form system:

http://www.forms.acmssite.com

我在第一个上有一个 iframe,可以查看后者中的一个表单.

I have an iframe on the first that looks at a form in the latter.

我需要运行脚本来从前者操作后者,我想知道这可能吗?

I need to run scripts to manipulate the latter from the former and was wondering is this possible?

推荐答案

为了不受同源策略的限制,您可能需要在两个页面中执行此操作:

In order for this to not be restricted by the same origin policy, you will probably need to do this in both the pages:

document.domain = "acmssite.com";

这篇关于跨子域 iframe 和 JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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