QuerySelectorAll works normally in Firefox, but in Chrome it does not. I would like to know if anyone can help me in such an issue, follow the code.
<script>
document.querySelectorAll('a').forEach(link => {
let conteudo = document.getElementById('conteudo')
link.onclick = function (e) {
e.preventDefault()
fetch(link.href)
.then(resp => resp.text())
.then(html => conteudo.innerHTML = html)
}
})
</script>
The following error appears in the console:
Uncaught (in promise) TypeError: Failed to fetch at HTMLAnchorElement.link.onclick
HTML
<body data-spy="scroll" data-target=".navbar-collapse">
<nav class="navbar navbar-inverse" style="background-color: #000080; height: 40px; font: bold 15px Arial, sans-serif;">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#" style = "font: italic 20px Verdana;">KAUYYZI</a>
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<i class="fa fa-user-md"></i>
<span class="icon icon-bar">A</span>
<span class="icon icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse">
<ul class = "nav navbar-nav">
<li>
<a href="tabela.html">Contato</a>
</li>
<li>
<a href="agendamentoPaciente.html">Agendamento</a>
</li>
</ul>
</div>
</div>
</nav>
<section id="conteudo"></section>
<footer class = "ftr">
KAUYYZI 2018 ©
</footer>
Network Error
URL scheme must be "http" or "https" for CORS request.