Question

I am creating a web site include navigation bar using only front end code...html ,css and script. but I want to add nav bar in each page by an already created html file.

I am using HTML5 that deprecated frameset tag. So which technique could I use without other backend code to add that html file to another one? Thanks.

<frameset rows="200,*" frameborder="no" border="0" id="container" scrolling="yes">
    <frame src="nav.html" name="leftframe" scrolling="no" noresize="noresize" id="nav" />
    <frame src="slider.html" name="rightframe" scrolling="no" noresize="noresize" id="slider" />
    <frame src="text.html" name="bottomframe" scrolling="no" noresize="noresize" id="text" />
    <frame src="copy.html" name="bottomframe" scrolling="no" noresize="noresize" id="text" />
</frameset>
Was it helpful?

Solution

You can switch <frame> for the <iframe> element and get the same results with some CSS.

OTHER TIPS

using jQuery:

<html> 
  <head> 
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
      <script> 
        $(function(){
         $("#navbar").load("navbar.html"); 
        });
      </script> 
  </head> 

  <body> 
   <div id="navbar"></div>
  </body> 
</html>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top