This article mainly introduces the flicker-free web page content JS implementation, there is a need for friends can refer to
The Todo list has a larger topic for updating Web pages without blinking. Loaded HTML string (obtained via Ajax), and if you need to run the code, then there is definitely a problem. You want to host this object with an IFRAME that does not appear. It's a little dirty work. The final solution is the following code: var str2domelement = function (HTML) {var frame = document.createelement (' iframe '); Frame.style.display = ' None '; Document.body.appendChild (frame); Frame.contentDocument.open (); Frame.contentDocument.write (HTML); Frame.contentDocument.close (); var el = Frame.contentDocument.body.firstChild; Document.body.removeChild (frame); Return el; var markup = ' <div><p>text here</p></div> '; var el = str2domelement (markup);