Generally, it can be supported by IE9 and above browsers, chrome and other browsers
var iframe = document.createElement('iframe'); iframe.src="http://www.jb51.net"; document.body.appendChild(iframe);
But considering browser compatibility issues, you can use the following code
try{ var iframe = document.createElement('<iframe name="ifr"></iframe>'); }catch(e){ var iframe = document.createElement('iframe'); iframe.name = 'ifr'; }
or
if(ie && version < 9) { var iframe = document.createElement('<iframe src="http://www.jb51.net"></iframe>'); } else { var iframe = document.createElement('iframe'); iframe.setAttribute('src','http://www.jb51.net'); }