Assume we have a client-server application communicating over the net, with client side written in javascript (so pretty much opensource). Let's say for example that we want to run multiplayer in-browser game and gather some revenue from ads. We want to stay in business, so we keep secured the server part, which handles most of the logic, and we accept that frontend/UI handling client is thrown into the wild and might be messed with by anyone.
Question is: how to detect and prevent the situation where someone copies all public facing content of web app, including JS client, puts it on his/her own server with his/her own advertisements, potentially malware etc, while the 'hijacked' client still talks to our original server?
Or perhaps that's just silly and there is some obvious reason why such behaviour would not work (that might be why I haven't found anyone mentioning it)? I'm feeling like I'm missing something there, but nothing in my experience so far tells me that hypothetical situation from the paragraph above would not be possible or even profitable for a highjacker.