Here you go:
var iframe; iframe = document.createElement('iframe'); iframe.src = 'http://example.com/file.zip'; iframe.style.display = 'none'; document.body.appendChild(iframe);
Live demo: http://jsfiddle.net/USSXF/2/
Your code does not work because you pass the entire HTML string to the createElement function ("jQuery style" :) ), which is not valid. A valid parameter for this function is a string representing the tag name (for example, 'div' , 'iframe' , 'p' , etc.).
Read about document.createElement here.
source share