Recommend to search the size on the official website to assign width/height
your iframe
makes automatically gets straight, can put if you want the link of various games, this my opinion is better to do this DOM Expert. (Study Intermediate DOM).
Demo:
http://codepen.io/KingRider/pen/rLqyrA
Follows the code below (it costs expensive to make DOM rss):
<html>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<iframe name="ballswar" src width height scrolling="no" frameborder="0">
<p>Your browser does not support iframes.</p>
</iframe>
<script>
$(document).ready(function() {
var cors = "https://crossorigin.me/";
var jogo = "http://ballswargame53.bitballoon.com/index.html";
$.ajax({
url: cors+jogo,
type: "GET",
dataType: "Html",
success: function(obj) {
objtemp = $.parseHTML(obj);
$("iframe[name=ballswar]")
.attr('src', jogo)
.attr('width', $(objtemp).find('canvas')[0].width)
.attr('height', $(objtemp).find('canvas')[0].height)
}
});
});
</script>
</html>
This is the address https://crossorigin.me/
is a CORS, if the security of the site is denied to download the AJAX deliver code and must use CORS is the FACT. Follow understand about CORS (https://stackoverflow.com/questions/22083453/console-errors-failed-to-load-resource-neterr-insecure-response/36086326#36086326)
You can post the code ?
– Ricardo Mota
This one: <iframe frameborder="0" height="1000" name="ballswar" scrolling="no" src="https://ballswargame53.bitballoon.com/index.html" width="980"><p> Your browser does not support iframes. </p> ></iframe>
– WanGo's Lain
Understood and remove black background, an iframe object problem is external bitballoon site, but I think modify iframe property is complicated to move more DOM. Black case is a bitballon site this with black background with responsive site.
– KingRider
And replace
height="1000"
forheight="550"
, and I’ll study DOM Iframe.– KingRider