本文介绍了如何隐藏IFRAME SRC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,所有的iframe内运行的Facebook应用程序隐藏自己的IFRAME SRC,而不是真正的SRC有一个JavaScript的:。
我怎样才能做到这一点?我想,我的IFRAME会隐藏原始的src

I noticed that all the Facebook applications that running inside an iframe hiding their iframe SRC, instead of the real src there is a "javascript:""".How can i do that? I want that my iframe will hide the original src

谢谢!

推荐答案

Facebook应用程序是动态加载,这表示在HTML加载后SRC中被改变。这就是为什么你只能看到的javascript:; 。在src不隐藏,虽然​​,它仍然存在,并可以使用JavaScript来获得。

Facebook applications are loaded dynamically, which means the SRC is changed after the HTML is loaded. That is why you can only see javascript:;. The src is not hidden though, it is still there and can be obtained using javascript.

如果您正在使用jQuery,你可以使用这样的:

If you are using jQuery, you could use something like this:

<iframe src="javascript:;" id="myframe"></iframe>
<script>
$(document).ready(function() {
    $('#myframe').attr('src', 'http://facebook.com');
});
</script>

通过这一点,在iframe将有的javascript:; 作为源文件的HTML,但会加载 facebook.com

With this, the iframe will have javascript:; as src in the HTML, but will load facebook.com

这篇关于如何隐藏IFRAME SRC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 11:52
查看更多