3 ms·
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.
by gpnt 3y 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.
- niutech 3y agoYou can make it work with forms by using onsubmit and e.target.action