0

I am creating a local use user guide using Adobe Dreamweaver and Bootstrap. By local, I mean a Windows folder structure at /Users. I do not intend on using a service like Python or PHP. This will not be hosted and will be used in an offline capacity. I have a static navbar to be used on every page in the guide.

I have researched the code to make this possible. When previewing the page in Dreamweaver, the navbar is displayed on my page even though my navbar code is on a separate html doc. If I use the DW browser preview, which opens up Edge, I can also see the navbar (the URL that displays here is 127.0.0.1../index.html). When I try to view the file through a browser outside of DW, the page displays, but the Navbar is blank.

When I inspect, I am given "Access to XMLHttpRequest at 'file location here' from origin 'null' has been blocked by CORS policy". This tells me the browser on the server side is blocking the request to display my navbar. Why does it display locally? Can I make my navbar display without hosting it?

Here is what the script looks like on the file:

<!--This script is needed for vert navbar-->
<script src="js/jquery-3.4.1.min.js"></script>
</head>  
    
<body style="background-color: #e9eaee">
    <!--This script is needed for vert navbar-->
    <script>
    $.get("navbar.html", function(data){
    $("#sidebar").replaceWith(data);});
    </script>
    <div class="wrapper">
    <!--This element is needed for vert navbar-->
    <div id="sidebar"></div>
    </div
Casey S
  • 1
  • 2
  • One thing you should do is place the script tag after the element. CORS issue, unsure how that is happening with a relative URL. Is there some sort of redirection happening? – epascarello May 12 '23 at 17:20

0 Answers0