Home >Web Front-end >JS Tutorial >Why does my JavaScript code fail to load an HTML page into a div in Chrome?
Loading an HTML Page in a div Using JavaScript
Problem:
Inserting an HTML page into a div element using the innerHTML property fails in Google Chrome due to a prompt for a plug-in.
Solution:
The correct type attribute value for the object element is "text/html," not "type/html."
Code Snippet:
function load_home() { document.getElementById("content").innerHTML='<object type="text/html" data="home.html" ></object>'; }
The above is the detailed content of Why does my JavaScript code fail to load an HTML page into a div in Chrome?. For more information, please follow other related articles on the PHP Chinese website!