Forum How do I...?

HTML (via absolute URL) as Header-Content

Hi Guys,

is it possible, to include a separate html-document, reachable only via an absolute URL) as header / footer content?
It works, using a simple image-URL. If the url points to a (quite simple) html-document, it doesn't work.

I couldn't find a way... Any ideas?

Best Regards
Markus
mikeday
This is a bit tricky, I think it will require XInclude, which only works with XML and not HTML, or perhaps it will be possible with some JavaScript, I will investigate.
mikeday
Actually another possibility is to use the iframe element:
<style>
@page {
    @bottom {
        border: solid red thin;
        content: flow(footer)
    }
}

.footer {
    flow: static(footer)
}
</style>
<iframe class="footer" src="http://www.google.com"></iframe>
<p>Normal content</p>

However there may be some subtleties required to get the correct size and styling of content within iframe elements.
mikeday
Alternatively you could use JavaScript to issue an XMLHttpRequest, parse the text of the response with DOMParser, then extract the elements and copy them into the main document. However, it will be tricky to support nested styles this way.
Hi Mike,

this works perfect for me!

Thanks a lot!!!!

Markus