var s = document.createElement('iframe'); s.src= 'http://google.com' s.style.position = 'absolute'; s.style.margin = '0'; s.style.padding = '5px'; s.style.border = '1px solid red'; Code (markup): Here is a snippet of my JavaScript code, it works just fine creating the iFrame with the red border, etc. But it will not display Google inside of it, any one see what I'm missing here?
You can't show Google in an iframe, Google sends an "X-Frame-Options: SAMEORIGIN" response header, It stops the browser from displaying iframes that are not hosted on the same domain as the parent page.
... and of course being 2013 instead of 1998, one has to ask why you are even TRYING to use iframes in the first place, much less applying that much style from the scripting instead of the stylesheet -- but since you're trying to wrap google with it, sounds like you're already trying to do something fishy.