is it good practice to use iframe to implement header/navbar?
my website is basically 5 thousand pages but all static html (not using any content manager, php, etc.).
am in the process to add a navbar at the top of each page. e.g. tabs, or crumbs, or any sort of header with js menu. (the exact design not decided yet)
my question is, is it good practice to use a iframe for this? (so, instead have same text repeated in all 5 thousand pages, each will just have a short iframe pointing to a header file)
am aware that one should reduce http request for speed, but this is ok with me. Any other problems i might have with this? SEO or any tech issue?
An inline frame (iframe) is a HTML element that loads another HTML page within the document. It essentially puts another webpage within the parent page. They are commonly used for advertisements, embedded videos, web analytics and interactive content.
Inline frames (shortened to iFrames) were introduced in the late 1990s by Microsoft, making it one of the oldest HTML tags. From a technology perspective, it's ancient. That said, there are still some legitimate use cases for iFrames.
There are two primary methods: 1.) Sending an X-Frame-Options HTTP response header that instructs the browser to disable framing from other domains. An example of using PHP to send the X-Frame-Options header.
An iFrame, also knowns as Inline Frame, is an element that loads another HTML element inside of a web page. They are commonly used to embed specific content like external ads, videos, tags, or other interactive elements into the page.
Using iframes to display parts of the same document is not good practice. Consider the document as a whole and that should give you the answer. Or consider that there are devices who don't do well when encountering iframes. And speaking of SEO is funny. Documents without header of footer (hence no internal links), or with just the navigation pointing to other iframe wrappers don't do well.
If your goal is to avoid using a dynamic language, how about going for SSI (Server Side Includes)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With