Luey
asked on
easyXDM resize iframe based on content still shows scroll bar
I am trying to use easyXDM to resize an iframe based on its content (cross domain). I can make it all work except that it still leaves a scroll bar. Here is my test code.
Test Page
Code for the page to embed the iframe
Code for the document to be embeded
Test Page
Code for the page to embed the iframe
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="/javascript/easyXDM.min.js" type="text/javascript"></script>
</head>
<body>
<!-- use css to style this and its contained iframe --><div id="container"></div>
<script type="text/javascript">
new easyXDM.Socket({
remote: "https://prizemagnet.com/giveaway_widget_2.php?giveaway_id=288",
container: document.getElementById("container"),
onMessage: function(message, origin){
this.container.getElementsByTagName("iframe")[0].style.height = message + "px";
this.container.getElementsByTagName("iframe")[0].style.width = "650px";
}
});
</script>
</body>
</html>
Code for the document to be embeded
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="/support/giveaway_widget.css" rel="stylesheet" type="text/css" />
<script src="/javascript/easyXDM.min.js" type="text/javascript"></script>
</head>
<body>
<div id="giveaway_entry_box">test</div>
</body>
<script type="text/javascript">
var socket = new easyXDM.Socket({
onReady: function(){
socket.postMessage(document.body.scrollHeight)
}
});
</script>
</html>
where is the scrollbar ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
accept your own solution
ASKER
I found this in the easyXDM examples and it cured my problem.