top | item 39452413

(no title)

gpnt | 2 years ago

Well, you are using javascript anyway so here it is a 163 bytes solution without the back button problem and iframe hack:

<script>onclick=async e=>{x=e.target.dataset.x;if(x){e.preventDefault();document.querySelector(x).innerHTML=await fetch(e.target.href).then(r=>r.text())}}</script>

<a href="/somepage" data-x="#lib">Hi</a>

<div id="lib"></div>

doesn't works with form though.

discuss

order

niutech|2 years ago

You can make it work with forms by using onsubmit and e.target.action