PLEASE HELP! How can you block links to another page

Hello sitepointers,

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…

Kind Regards,

Rahail

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.

That’s at most 2 key strokes or mouse clicks in Opera. :slight_smile:

Hello autisticcuckoo,

Can you please elaborate your sentence… explain it a bit please…

thanks,
rahail

pmw57,

Autistic cukoo is right… when you double click it, the signup box appears… how can you get rid of this?

Thanks,
Rahail

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.

Autistic cukoo,

How can this be addressed? I mean how can you stop a user disabling javascript with a keystroke or with anything else… ? in any browser…

I can disable it in firefox… same thing… so is there a solution?

thanks,
Rahail

You can’t. That’s the whole point. On the web the user is in control.

Okay, isn’t there any way in other languages? like php or xml … anything??

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’.

You only need one mouse click if you have the checkbox copied to the browser status bar.

You get the same one click option with Firefox with the noscript extension enabled.

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.

Yes, that’s why I wrote ‘at most 2’. :slight_smile:
It should also be possible to create a mouse gesture or keyboard shortcut to do the same thing.