我有一个带有屏蔽重定向服务的托管服务。
例如
我有这个域名:www.the_domain_whith_redirect.com
并重定向页面:http://www.the_real_path.com/index.html
在浏览器的地址栏中,我读到了“www.the_domain_whith_redirect.com”,但我查看了“http://www.the_real_path.com/index.html”内容
阅读页面的来源,屏蔽就像这样
<html>
<head>
<title>www.the_domain_whith_redirect.com</title>
</head>
<frameset framespacing="0" border="0" rows="0,*" frameborder="0">
<frame name="topmask" src="mask.htm" scrolling="no" noresize>
<frame name="bottommask" src="http://www.the_real_path.com/index.html" scrolling="auto">
</frameset>
</html>
我无法修改此内容,因为我无法访问“www.the_domain_whith_redirect.com”域名。它只是一个域名。 我可以通过我的提供商(Aruba.it)的控制面板修改重定向链接,即真实的物理页面。
立即。问题是:
我可以修改“主”页面的标题 (在此示例中:www.the_domain_whith_redirect.com), 通过Javascript或其他方式,从iframe内容?
这是因为浏览器在标题栏中向我显示“www.the_domain_whith_redirect.com”而不是“你好,这是我的实际网站的真实标题”
感谢您的回答
的奥斯卡
答案 0 :(得分:1)
显然你无法直接更改属性,但可以在父页面上调用一个函数来设置父页面的标题。
如果您的子页面(frame1.html)与父级页面位于同一个域中 页面,如果允许在中写入javascript代码 frame1.html,您可以从frame1.html调用父窗口的函数。
在子页面(frame1.html)中:
<a href="..." onclick="parent.callFromChildPage()">text</a>
并且,在父页面中:
<script language="javascript"> function callFromChildPage(){ $("#test1").html("<h1>clicked</h1>"); } </script>
而且,如果您可以在子页面(frame1.html)中使用jQuery,那么 可以直接设置父页面的元素,如下所示:
<a href="..." onclick="$('#test1', window.parent.document).html('<h1>clicked</h1>');">text</a>