LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Html that loads another html page on the same folder (https://www.linuxquestions.org/questions/programming-9/html-that-loads-another-html-page-on-the-same-folder-4175560170/)

Ulysses_ 11-29-2015 04:08 PM

Html that loads another html page on the same folder
 
I routinely export all bookmarks onto an html and this is my home page. When this is loaded, the dns prefetch annoyingly sends hundreds of dns requests. To disable dns prefetch for this page only, it requires this line to be added to the html:

<meta http-equiv="x-dns-prefetch-control" content="off">

Which is lost every time the bookmarks are exported. Instead, it would be nice if an additional html was used and set as the home page that loads the actual bookmarks html while disabling dns prefetch as above.

How does an html page load another html page located on the same folder?

norobro 11-29-2015 06:52 PM

Quote:

Originally Posted by Ulysses_
How does an html page load another html page located on the same folder?

I use the following statements in index.html on one of my sites. I just have to comment/uncomment to redirect to a particular page.
Code:

<meta http-equiv="refresh" content="0; url=home.html">
<!-- <meta http-equiv="refresh" content="0; url=calendar.php">  -->
<!-- <meta http-equiv="refresh" content="0; url=back_soon.html"> -->

The problem with the above is that turning off prefetch only applies to the current page.

From the chrome (didn't check any other browsers) docs:
Quote:

Child frames also inherit the DNS prefetch control opt-out setting from their parent.
So if you can live with your bookmarks in an iframe this should work:
Code:

<meta http-equiv="x-dns-prefetch-control" content="off">
<iframe src="bookmarks.html" style="border:none" width="some_width"  height="some_height">
</iframe>


Ulysses_ 11-29-2015 07:44 PM

Just tried it. It does not work with local files. Chrome seems to have dns prefetch disabled for local files. Firefox has it enabled but does not disable it this way.

norobro 11-29-2015 08:29 PM

Sorry, for some reason I thought you were serving the page not just opening it in a browser.

Ulysses_ 11-30-2015 05:12 AM

Any other way to embed an html file inside an html file?

Diantre 11-30-2015 08:59 PM

Quote:

Originally Posted by Ulysses_ (Post 5457275)
Any other way to embed an html file inside an html file?

Yes, there are a few ways. There's a method using JQuery, described here. But I think the HTML5 object tag is particularly useful.

Ulysses_ 12-01-2015 08:29 AM

The HTML5 object tag works. Here's the complete html with the object size adjusted to fit the window:

<TITLE>Bookmarks with dns prefetch disabled</TITLE>

<meta http-equiv="x-dns-prefetch-control" content="off">

<object name="foo" width="100%" height="99%" type="text/html" data="bookmarks.html"></object>

One minor annoyance: you need to open links in a new tab or window otherwise the url does not appear in the url bar and new sites do not appear in history.


All times are GMT -5. The time now is 02:57 AM.