Answer the question
In order to leave comments, you need to log in
How to load html into html?
I found an article on Habré What is HTML import and how does it work?
Everything works according to the examples:
intro.html
<div id="intro-dm">
<h2>We're an awesome blog about web design</h2>
<p>Designmodo is a great resource of informative material for designers and web developers. We are makers of highly-rated User Interface Packs, you can get acquainted with Designmodo shop here, and you can download a couple of other ui packs for free.</p>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>What are HTML imports and how do they work</title>
<link rel="import" href="/intro.html">
</head>
<body>
<h1>Hello from Designmodo</h1>
</body>
</html>
var link = document.querySelector('link[rel=import]');
link.setAttribute('href', 'intro.html');
var content = link.import.querySelector('#intro-dm');
document.body.appendChild(content.cloneNode(true));
Answer the question
In order to leave comments, you need to log in
Why are you trying to override href - link.setAttribute('href', 'intro.html');?
var link = document.querySelector('link[rel=import]');
var content = link.import.querySelector('#intro-dm');
document.body.appendChild(content.cloneNode(true));
Not an expert, but why not embed the html in an iframe?
$("#iFrame").attr("src", "page.html")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question