Jump to content

Simple Javascript "show If" Help

Recommended Posts

Javascript doesn't provide any security for that type of thing, is PHP an option? You can still use Javascript to send an ajax request to PHP to check the password and return the filename, but if you have things like the path to the file or the password checking in Javascript code then anyone can read that.

Link to post
Share on other sites

You can use the window.prompt function to get the password. If the password is correct then you can use window.open to open the link to the document in a new window, or you can set window.location.href to redirect the current page to the document.

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...