# ktor


07/15/2022, 5:50 PM
whats a good way to access the location hash thing in a html (like:, everything after #) in ktor? This doesn't seem to work:
Copy code
get("/") {
    call.respondText(ContentType.Text.Html) {
            <!DOCTYPE html>
            <html lang="en">
                <title>Supabase In App Authentication</title>

                const pairs = location.hash.substring(1).split("&").map(pair => pair.split("="))
Is there a good way without using templates or something?
Note: I don't wanna access the hash directly in ktor I just want that html to work
if I try that I just see a blank site
Ok nvm the url was just pointing to a html website but its not ending with html so

Eric Grimsborn

07/17/2022, 2:45 AM
If you are responding with HTML from your ktor backend you might want to check out
kotlinx.html It is not templating but rather a way of writing typesafe html with code. You would have something like this instead
Copy code
call.respondHtml {
    head {
        title("Supabase In App Authentication")
    body {
        script {
            unsafe { // will not escape the text
                +"""const pairs = location.hash.substring(1).split("&").map(pair => pair.split("="))"""