What sort of webserver does BTT use to serve on localhost? (Apache, nginx, etx?)
I'm using the webserver to display a cool html cheatsheet thingy on a floating menu. I use the link http://localhost:1234///cheaters-master/cheaters/index_local.html
and it works great. But it would be even better to use hash links like
http://localhost:1234///cheaters-master/cheaters/index_local.html#freeform
Note the
and have it load specific pages in the same window without me making multiple menus with a different link.
Apache or nginx would be way overkill It's a super simple embedded webserver. I'll check whether I can add support for hash urls there.
For now it would be easy to get this working with Java Script and URL parameters instead (e.g. http://localhost:1234///cheaters-master/cheaters/index_local.html?scrollTo=freeForm )
Something like this should work:
<!DOCTYPE html>
<html lang="en">
<head>
<script>
document.addEventListener("DOMContentLoaded", function() {
// Function to get the value of a specific query parameter
function getQueryParam(param) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
// Get the scrollTo parameter from the URL
const scrollToId = getQueryParam('scrollTo');
// Check if scrollToId has a value and the element exists
if (scrollToId) {
const elementToScroll = document.getElementById(scrollToId);
if (elementToScroll) {
// Scroll to the element
elementToScroll.scrollIntoView({ behavior: 'smooth' });
} else {
console.warn('Element with ID:', scrollToId, 'not found.');
}
} else {
console.warn('No scrollTo parameter found in the URL.');
}
});
</script>
</head>
<body>
<div id="test1" style="width:200px;height:200px;">1</div>
<div id="test2" style="width:200px;height:200px;">2</div>
<div id="test3" style="width:200px;height:200px;">3</div>
<div id="test4" style="width:200px;height:200px;">4</div>
<div id="test5" style="width:200px;height:200px;">5</div>
<div id="test6" style="width:200px;height:200px;">6</div>
<div id="test7" style="width:200px;height:200px;">7</div>
<div id="test8" style="width:200px;height:200px;">8</div>
</body>
</html>
Hey Andreas. Do you think you will provide a patch for this in the upcoming future ? I can’t read Java script. It would be very cumbersome trying to get it to work with your workaround. Is there a reason it hash-url’s don’t work? I can forward your response to the developer who wrote the original HTML cheat sheet who has shown interest in fixing it. (Brett Terpstra). Cheers