I really enjoy the !-bang and use it quite a lot to get somewhere fast, without bothering with parsing the search results first.
Sometimes though, I use it with insufficient search terms which results in me ending up on an undesired page. My natural instinct is to click my browser's back-button to get back to the search results in order to pick the correct page; the only problem is that these results don't exist. I propose that Kagi supports this use case.
This could be realized by implementing an intermediary page that detects use of the back-button, like the HTML below (tested and working):
<!DOCTYPE html>
<html>
<script>
window.addEventListener('pageshow', () => {
if (window.performance.navigation.type === window.performance.navigation.TYPE_BACK_FORWARD) {
//SHOW THE RESULTS PAGE
} else {
//REDIRECT TO TOP RESULT
//THIS FEATURE DOES NOT WORK WITHOUT THE setTimeout EXECUTION, ALTERNATIVES TO THIS SOLUTION HAVE NOT BEEN EXPLORED
setTimeout(() => {
window.location.assign([TOP RESULT URL]);
}, 1);
}
});
</script>
<body>
</body>
</html>
Not being able to use the back-button in this exact scenario actually ends up making the !-bang less useful than searching regularly as its current implementation leads to more time used searching if the search query is insufficient.
With this feature, we get the best of both worlds; super fast results but with the ability to use the results page as a fallback, without needing to restart the process.