1
這可能是常見的問題。我看到了這個問題的幾個答案。加載網絡鏈接到div或iframe
- 使用iframe的
我想他們兩個,不能輕鬆地將使用jQuery負載
<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>
但是當我嘗試加載w3schools.com它加載到的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>
當使用jQuery加載它也不起作用。
<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>
而在螢火蟲欄顯示這個以「GET http://www.google.com 302 Found 291ms
」
一些身體幫我擺脫這一點。
你想做什麼? – Chanckjh
@Chanckjh:原諒錯別字,不是每個人都寫好英文 – JFK
我想這是這個的重複:http://stackoverflow.com/questions/8524449/google-homepage-will-not-load-in-an- iframe – Chanckjh