使用JQuery获取iframe的当前src

用户单击不在同一个域的iframe中的页面上的链接时,我需要收到通知。我知道xss的限制,但是我需要知道的是在iframe中提供的当前页面。有没有办法这样做,而不违反xss规则?

解决方法

如果不是跨站点脚本限制,这应该是正常的。不幸的是,我不知道如何获取URL而不违反这些限制。
<html>
    <head>
        <script type="text/javascript">
            function GetIFrameUrl()
            {
                alert('url = ' + document.frames['frame1'].location.href);
            }
        </script>
    </head>
    <body>
        <a href="#" onclick="GetIFrameUrl();">Find the iFrame URL</a>
        <iframe name="frame1" src="http://www.google.com" width="100%" height="400"></iframe>
    </body>
</html>

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...