Looking to make it so that after a user opens a document after a specified number of times that the document expires and they can't open it again.
Copy link to clipboard
In theory it's possible, but it's extremely easy to get around it, making it not worth the trouble.
What if the user opens the file and then closes it without saving it? The "counter" will note update and the user will be able to continue opening the file without problems. Also, they can simply disable JS and this entire mechanism won't work at all.
If you want to do it in a way that's reliable you need to shell out large amounts for a DRM solution.