D
D
DTHRT2022-04-17 11:33:28
HTML
DTHRT, 2022-04-17 11:33:28

How to embed external HTML in a page?

Briefly:
There is a page , it needs to be inserted into another html page using JS. At the same time, the embedded page should not lose its styles and js scripts.

A little more:
I have a finished folded page from the previous program. This page must be embedded in CS CART (on one of the store pages on the CS CART platform). Previously, the implementation was as follows:

The following code was simply added to the required page

<head>
 <link rel="import" href="путь_к_файлу/встраиваемая_страничка.html">
</head>

<script>
 var link = document.querySelector('link[rel="import"]');
 var content = link.import;
 var el = content.querySelector('#fx-wrap');
 document.body.appendChild(el.cloneNode(true));
</script>


However, as I learned from Google, Google withdrew this opportunity. How to be now?

PS The page should look "native". No additional scrolls, etc. Therefore, I believe that iFrame is not suitable here.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2022-04-17
@SilenceOfWinter

https://developer.mozilla.org/en-US/docs/Web/API/F...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question