There was a need to import content from another site. On the server of another site, I allowed content to be received by my site, through Access-Control-Allow-Headers , in order to make it possible to receive content from there. On your page did the following:
<header class="header"> <link rel="import" href="http://стороннийсайт/" /> </header> The script itself, which appends the received content from a third-party site:
<script type="text/javascript"> $(document).ready(function() { var link = document.querySelector('link[rel="import"]'); var content = link.import; if (content != null) { var el = content.querySelector('.header'); document.getElementsByTagName('header')[0].appendChild(el.cloneNode(true)); } }); </script> Yes, from another site I take the leader, which is a menu with several links. What is the result that does not suit me:
- The image from the received content does not pull up
- Embedded content links change
Accordingly, I have two questions:
- How to upload an image from another site to yours?
- How to make the right link?
Explanations for the second issue:
If you go to a third-party site page, then it has links of the following format:
http: // third party / other / first
http: // third party / other / two
http: // third party / about
After I get the content from a third-party site and embed it in my own, the links change:
http: // mysite / other / first
http: // mysite / other / two
http: // mysite / about
I need the links to not change, but remain the same as on a third-party site.