It seems like a common issue. I've come across multiple solutions for this problem.
- using jquery load
- using iframe
I attempted both methods but encountered difficulties in loading content. Specifically, I tried to load google.com and it didn't work as expected.
<html>
<head>
<title>hhh</title>
<script src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#content").attr("src","http://www.google.lk/");
})
</script>
</head>
<body>
<iframe id="content" src="about:blank"></iframe>
</body>
</html>
Interestingly, when attempting to load w3schools.com, it loads successfully into the iframe.
<html>
<head>
<title>hhh</title>
<script src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#content").attr("src","http://w3schools.com/");
})
</script>
</head>
<body>
<iframe id="content" src="about:blank"></iframe>
</body>
</html>
Unfortunately, using jQuery load also proved unsuccessful in my case.
<html>
<head>
<script src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#content").load("src","http://www.google.com/");
})
</script>
</head>
<body>
<div id="content" src="about:blank"></div>
</body>
</html>
In the firebug console, an error was displayed "
GET http://www.google.com 302 Found 291ms
".
If anyone has a solution to this issue, please assist me in resolving it.