Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
65
rated 0 times [  67] [ 2]  / answers: 1 / hits: 186633  / 13 Years ago, wed, january 4, 2012, 12:00:00

I have a webpage hosted online and I would like it to be possible that I could insert an IFRAME onto another webpage using some JavaScript.



How would this be the best way possible, that I just add my webpage URL to the JavaScript and that it work on all browsers?



Thanks


More From » javascript

 Answers
35

You can use:



<script type=text/javascript>
function prepareFrame() {
var ifrm = document.createElement(iframe);
ifrm.setAttribute(src, http://google.com/);
ifrm.style.width = 640px;
ifrm.style.height = 480px;
document.body.appendChild(ifrm);
}
</script>


also check basics of the iFrame element


[#88241] Monday, January 2, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tobyl

Total Points: 598
Total Questions: 110
Total Answers: 114

Location: Vietnam
Member since Sat, Feb 12, 2022
2 Years ago
;