simonAS;Trying to explain these concepts would be beyond the capabilities of the format of this forum. If you do not understand what I've said you'll need to educate yourself on their meaning.
Do a Google search for "JavaScript external .js file" to find out what an external .js file is and how to add it to your HTML web page.
To understand htaccess... Do a Google search for "htaccess restrict IP access" This information should help you understand what htaccess is and how to use it. (your web site must also allow you to add htaccess control .. Some don't!)
Once you understand these concepts -- Create a .js file ( a plain text file ) and add one line of text something like "pass=yes" and save the file to your htaccess protected folder as i.e. "passme.js"
Then in your web page add the code to load an external .js file SRC="http://yourwebsite.com/htaccessFolder/passme.js"
Finally in your Web page you'll need to add some JavaScript code that will only allow your eBook to open only if the .js file is loaded. for example:
if (pass == "yes" ){
// open eBook code added here
}
This code could be something as simple as a redirection link on an introductory page that allows access to the remaining contents.
Ron