How can I hide my javascript code?

[ad_1]

I’m making a little page for an IRL event. The event involves a game that works like this:

1. Attendee finds a codeword IRL
2. Attendee goes to my website and enters the codeword
3. If they enter a valid codeword, they score a point for their team

I’ve got it set up so that there’s a wordpress page with a form, and the form activates a script that knows all the valid codewords. If the codeword is valid, the user gets a point. If it’s not valid, the user gets a message saying to try again.

My trouble is, anyone could click “View Page Source”, scroll through the script and look up *all* the codewords immediately. That would ruin the game. So I want the script to be in a separate file (like CodewordSearch.js or whatever), and the frontend just loads that script without revealing its contents.

Is there a way to do this? I have to do it in WordPress because the game is based on a pre-existing site that already uses WordPress.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer