I am not a javascript developer… so please elaborate your answer for me…
How can you block some or all links on a website?
For example, when a visitor lands on the homepage and see a link to another page on the homepage… How can you block the link to another page and make a popup appear with links and text…?
To elaborate my question, here is an example:
visitor come on a homepage of a website…he sees a link to a wonderful article… when he clicks it, the link is blocked and a popup appears asking him to checkout a free offer and once you enter your email address, the link will become accessible…
Please help because i am interested in getting a javascript developer for this…
Though I’m not that keen on how it’s going to be used to get in a visitors way, you can use a modal dialog box, as in the demo at http://jqueryui.com/demos/dialog/#modal-form (select the “Create new user” button.
For your use of it, it doesn’t matter whether it’s a button or a link that’s activating the dialog box.
If it were me visiting your page I would personally want to find some way to get by pass any attempts to get me to sign up in return for getting through to page in question.
It was a response to Paul’s post. In Opera you can disable/enable JavaScript with two key strokes or mouse clicks, which would bypass what you are trying to achieve.
Please understand that the web isn’t about ‘preventing’ or ‘stopping’ or ‘forbidding’. It’s about allowing and enabling.
You could replace the links with links to server-side scripts that display the annoying pop-ups unless the user is logged in. That would require some PHP code or similar. You could, of course, then use JavaScript to display the pop-ups without a server round-trip for the majority who surf with scripting enabled.
Or you could do what I’ve seen in a forum (non web related): for users who are not logged in, display a message instead of the links. Along the lines of, ‘to see links you must be a logged-in member’.
A fundamental tenant of programming JavaScript for the web browser, is that you cannot guarantee the script will be run. Always begin from a first assumption of no JavaScript. The scripting is an optional extra to improve the user experience.