如何禁用其他网址开放使用的iFrame的按钮? [英] How to disable the buttons of other URL opening using Iframe?

查看:107
本文介绍了如何禁用其他网址开放使用的iFrame的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我米使用iframe来打开另一个web服务。有用户可以查看完整的有针对性的链接导航。但我wan't到prevent用户查看完整的资产净值。

I m using iframe to open another webservice. there user can view the complete the nav of the targeted link. but i wan't to prevent the user to view the complete nav.

有在targetd URL这样的五个项目:

There are five items in the targetd URL like this:


  1. 概述

  2. 通话记录

  3. 好极了

  4. 付款

  5. 注销

  1. Overview
  2. Call Log
  3. Terrif
  4. Payment
  5. Logout

<iframe id="subframe" frameborder="0" scrolling="no" src="login.aspx" style="float: left;height: 754px; margin-left: 118px;  width: 727px;"  ></iframe>


现在我想那是什么,让用户只查看通话记录。

Now what i want is that, allow user only to view the Call Log.

怎么能这样可能这样做?

How could be this possible to do?

这可能是采取措施来执行这些呢?

Which steps could be taken to perform these all?

推荐答案

如果该服务是在你自己的域名,您可以访问DOM帧像这样:

If the service is on your own domain, you can access the frames DOM like so:

var myFrame = frames["myFrame"]

var cssLink = document.createElement("link") 
cssLink.href = "iframeStyles.css"; /* change this to the url for a stylesheet targetting the iframe */
cssLink .rel = "stylesheet"; 
cssLink .type = "text/css"; 
frames['myFrame'].document.body.appendChild(cssLink);

也看到了这个问题:
<一href=\"http://stackoverflow.com/questions/10478251/how-to-add-css-class-and-control-elements-inside-of-the-iframe-using-javascript\">How添加CSS类和控制元件使用JavaScript iframe的内部。?

如果在iframe装载来自另一个域中的网页,你可以不改变它,因为那将是对同一产地的政策。

If the iframe loads a page from another domain, you may not alter it, because that would be against the same origin policy.

这篇关于如何禁用其他网址开放使用的iFrame的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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