I am looking to create a section of an HTML page that can only be accessed through a specific code. The page is coded using pure HTML, CSS, and JavaScript.
Here is the proposed logic:
- User inputs a string into a form
- Upon clicking the submit button, an xmlHttpRequest is triggered to check if the string matches the designated code
- If verified, another xmlHttpRequest is sent to retrieve the HTML content for the secret section of the page
The main concern is: How can I prevent users from easily inspecting the JavaScript code and gaining access to the XML files based on their file names?
Can this be achieved using pure AJAX, or is it necessary to implement a server-side script for code verification?
Also, in case a server-side script is necessary, what would be the most effective and straightforward way to implement this?