Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide iframe url in HTML source code

Tags:

iframe

How to hide iframe url From HTML source code?

<iframe src="http://mysite.com" frameborder="0" scrolling="no" width="728" height="90"></iframe>
like image 844
user2128747 Avatar asked Mar 21 '13 12:03

user2128747


1 Answers

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>

Example here.

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

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

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.

like image 170
wzazza Avatar answered Dec 23 '22 08:12

wzazza