74 posts
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • United States
AaronMarquez says

Hello, How about a neat script that warns users when clicking links that are out of a specific site?

Okay, scenario.

A user is on a site called domainname.com , he clicks a link that goes to Google.com Well, what this plugin would do is make there be some kind of “confirmation” but not the ugly default confirm box. But it would say, when he clicked on that external link “are you sure you want to leave” or something like that. Something with a nice UI and responsive.

Does this exist or can anyone make something like this?

5070 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
Australia says
74 posts
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • United States
AaronMarquez says

Thanks. Maybe you didn’t read my post in it’s entirety, I said I didn’t want to use the default “ugly confirm box.” Any alternatives? Thanks! :)

5070 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
Australia says

I read your post, i take it you are a complete noob at this stuff?

Like deviantart use! http://www.deviantart.com/

335 posts
  • Netherlands
  • Sold between 10 000 and 50 000 dollars
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Exclusive Author
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
  • Has been a member for 3-4 years
RikdeVos says

Yes, you can run a script when the user quits the page. You cannot however prevent him from leaving the page other than the default confirm box, this is because of security reasons. I suggest using something like this:

<script>
$(document).ready(function() {
   $("a").click(function() {
      //do stuff here
      if(!success) {
         return false;
      }
   });
});
</script>

But of course it won’t register events where the anchor tag isn’t clicked, so you should use the window.onbeforeunload as a backup.

338 posts
  • Most Wanted Bounty Winner
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Author had a Free File of the Month
  • Microlancer Beta Tester
  • Bought between 10 and 49 items
amzee says

I understood your requirement and can do it. Please PM me if you are still interested. Thanks.

74 posts
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • United States
AaronMarquez says

I read your post, i take it you are a complete noob at this stuff? Like deviantart use! http://www.deviantart.com/
It’s not that I’m a noob, I’m simply suggesting one thing and you are giving me another.

Read the posts before you respond. This is the second time you’ve responded with some snide remark, no one is forcing you to post. I appreciate the help but when I ask a question and attempt to explain in further detail, there is no need to get snide.

74 posts
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • United States
AaronMarquez says

Yes, you can run a script when the user quits the page. You cannot however prevent him from leaving the page other than the default confirm box, this is because of security reasons. I suggest using something like this:
<script>
$(document).ready(function() {
   $("a").click(function() {
      //do stuff here
      if(!success) {
         return false;
      }
   });
});
</script>
But of course it won’t register events where the anchor tag isn’t clicked, so you should use the window.onbeforeunload as a backup.
Thanks for the help!
74 posts
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • United States
AaronMarquez says

Thanks for the answers guys.

5070 posts
  • Australia
  • Bought between 100 and 499 items
  • Community Superstar
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
  • Microlancer Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
Australia says

No problems, last time i will reply to one of your many threads

by
by
by
by
by
by