有沒有辦法在一個HTML文件中包含一個HTTP請求(包含text/html或text/plain)的內容?當然,這可以通過AJAX或在服務器端完成,但我對純粹的瀏覽器HTML方式感興趣。也許使用<link>
標記,或者我不熟悉的一些HTML5方法?如何從純html加載html文本?
例如: 的index.html:
<!DOCTYPE html>
<html>
<head></head>
<body>
<p>This is my text loaded from the original document</p>
<p>This is text I want to load from another file: <span id="other"><!-- link other resource here --></p></span>
</body>
</html>
otherResource.html:
<p>This is from another resource</p>
我認爲這是最好的非代碼方式。 – nycynik