python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.29k stars 582 forks source link

How does eel prohibit f12 from viewing source code #633

Closed zhenzi0322 closed 1 year ago

zhenzi0322 commented 1 year ago

How does eel prohibit f12 from viewing source code

anay-p commented 1 year ago

Since Eel uses a browser to render the website, I don't think there is any real way to completely prevent the user from accessing the source code. Still, if you want to stop the user from being able to use the F12 key specifically, you could do something like:

document.addEventListener("keydown", (event) => {
    if (event.key == "F12") {
        event.preventDefault();
    }
})