0

So I'm playing with an idea that I would like to only display a html button that a user can then click and download an exe if that are with a certain range of ip addresses.... The reason is I am putting together an app but depending on the users location they do not need to see certain buttons.... Anyone have any ideas or examples they can share please

Thanks

1 Answers1

0

I think the best way to do this would be to serve different webpages from your server after reading the IP associated with the incoming request. That way it's pretty much invisible to the client. Something like this in Express would work.

app.get("/", (req,res) => {
    if (req.ip === "127.0.0.1") {
        res.sendFile("index-no-exe.html")
    } else {
        res.sendFile("index-with-exe.html"
})

It's possible to do this in the browser as well. You could hide or delete the button element after retrieving their IP address from a service, but that could easily be reversed engineered. See this SO post.