在HTML源代码中隐藏iframe网址 [英] Hide iframe url in HTML source code

查看:1250
本文介绍了在HTML源代码中隐藏iframe网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何隐藏 iframe网址来自 HTML 源代码?

<iframe src="http://mysite.com" frameborder="0" scrolling="no" width="728" height="90"></iframe>


推荐答案

您可以使用javascript加载源代码,它在页面源代码中的 iframe url 中不可见。
例如 jQuery

You can use javascript to load the source, and it will not be visible in iframe url in page source code. For example with jQuery:

<script type="text/javascript">
$(document).ready(function(e) {
  $('iframe').attr('src','http://www.flickr.com/');
});
</script>

<body>
<iframe src="" />
</body>

这里的示例。

您可以将它与 $。post 组合以获取值serveride:

You can combine it with $.post to get the value serverside:

$.post('get-iframe-src.php', function(data) {
  $('iframe').attr('src',data);
});

您甚至可以将 iframe 本身加载到某些元素如:

You can even load iframe itself to some element like:

$.post('get-iframe.php', function(data) {
  $('#element_id').html(data);
});

等。解决方案很多,这只是其中之一。

etc. solutions are many, this is just one of.

这篇关于在HTML源代码中隐藏iframe网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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