85 posts
  • Collector Level 4
  • United States
  • Exclusive Author
  • 5 Years of Membership
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?

5492 posts
  • 6 Years of Membership
  • Affiliate Level 1
  • Australia
  • Author Level 3
+5 more
Australia
says
85 posts
  • Collector Level 4
  • United States
  • Exclusive Author
  • 5 Years of Membership
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! :)

5492 posts
  • 6 Years of Membership
  • Affiliate Level 1
  • Australia
  • Author Level 3
+5 more
Australia
says

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

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

353 posts
  • Elite Author
  • Featured Item
  • Trendsetter
  • Winner
+10 more
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.

409 posts
  • Industrious API Inventor
  • Featured Author
  • Trendsetter
  • Most Wanted Winner
+7 more
pluginpunch
says

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

85 posts
  • Collector Level 4
  • United States
  • Exclusive Author
  • 5 Years of Membership
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.

85 posts
  • Collector Level 4
  • United States
  • Exclusive Author
  • 5 Years of Membership
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!
85 posts
  • Collector Level 4
  • United States
  • Exclusive Author
  • 5 Years of Membership
AaronMarquez
says

Thanks for the answers guys.

5492 posts
  • 6 Years of Membership
  • Affiliate Level 1
  • Australia
  • Author Level 3
+5 more
Australia
says

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

by
by
by
by
by
by