vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Warning when leaving to external site (https://vborg.vbsupport.ru/showthread.php?t=293051)

CoffeeLovesYou 12-16-2012 11:10 PM

Warning when leaving to external site
 
How can I make it like League of Legends' has their external warning set up?
Here is what I mean;
http://na.leagueoflegends.com/board/....php?t=2910177
if you go to that URL, you will see (3rd post) a link. click it and you will see the warning.
You post your link that is NOT on your board.
You click the link
You are leaving blahblah.com!
Press yes to continue, press no to go back
if they press yes, it brings them to the external url. if they press no, it brings them back to our forums (or the page before, whichever)

what is the simplest way to do this? Is there a mod for this?

CoffeeLovesYou 12-29-2012 01:54 AM

Bump.
Is this possible? :o
Easy way to do it?

CAG CheechDogg 12-29-2012 02:15 AM

Try the following:

PHP Code:

<script type="text/javascript">
var 
domain='http://www.jkadhkfakshjdfhkashfdjaksf.com'// Set your domain here.
window.onbeforeunload = function()
{
if(
this.location.href.indexOf(domain)==-1)
{
return 
"Are you sure you want to exit?";
}
}
</
script


Max Taxable 12-29-2012 02:16 AM

Quote:

Originally Posted by CoffeeLovesYou (Post 2393306)
Bump.
Is this possible? :o
Easy way to do it?

A quick google search shows this has been asked here several times since at least 2009, and I found no answers after visiting several of the links.

Have you tried asking that webmaster, using the "contact us" link, how they do it?

I examined their page source code and learned no clues.

HOWEVER, I did find THIS modification that does address this, for vB 3.8.x also using google search:

https://vborg.vbsupport.ru/showthread.php?t=217708

It's described in more detail by the developer here: http://www.websitepublisher.net/two-step/

Scroll down to "About the Plugins" and read that.... I think this is what you're looking for.

CAG CheechDogg 12-29-2012 02:23 AM

You can also try this one here:

PHP Code:

<html>
<
head>
<
script type="text/JavaScript">
function 
ExitPage()
{
alert ('Before You Leave:\n\n Your messsage here. \n\nMore message text here\n\nMore text here\n\nMore text here');
getit()
}
function 
getit() {
askit confirm("Leaving so soon? Why not stay a little longer!");
if (
askit == true)
alert('Thanks');
else
if (
askit == false)
alert("Visit again soon!");
}
</
script>
</
head>
<
body onbeforeunload="ExitPage();"


CoffeeLovesYou 12-29-2012 05:08 PM

Quote:

Originally Posted by Max Taxable (Post 2393309)
A quick google search shows this has been asked here several times since at least 2009, and I found no answers after visiting several of the links.

Have you tried asking that webmaster, using the "contact us" link, how they do it?

I examined their page source code and learned no clues.

HOWEVER, I did find THIS modification that does address this, for vB 3.8.x also using google search:

https://vborg.vbsupport.ru/showthread.php?t=217708

It's described in more detail by the developer here: http://www.websitepublisher.net/two-step/

Scroll down to "About the Plugins" and read that.... I think this is what you're looking for.

Thanks, this worked perfect. I used this instead of what you suggested, CAG, because I wanted this type of redirect, not a JS alert (since not all browsers support)
Thank you though!!

CAG CheechDogg 12-29-2012 11:41 PM

No problem buddy.

Question, did you get this to work on vB4 or are you using vB3?

--------------- Added [DATE]1356828126[/DATE] at [TIME]1356828126[/TIME] ---------------

Nevermind ! lol..I didn't see this is posted on vB3 ! lol...I feel dumb !lol


All times are GMT. The time now is 04:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04040 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete