The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Redirect into new tab, Redirection
americast but from India
post Aug 1 2012, 04:56 AM
Post #1


Newbie
*

Group: Members
Posts: 12
Joined: 1-August 12
Member No.: 17,530



I want my users to go to another website when they close my website. So, I used the given code but I cannot understand what is wrong in it. Please help. Thanx for any help...

[code]
<script type="text/javascript">

window.onunload = unloadPage;

function unloadPage()
{
window.open("exampleurl","_blank")
}
</script>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Darin McGrew
post Aug 5 2012, 05:12 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



QUOTE
Have you heard of any command: onexit ?
Perhaps you're referring to the onclose event handler.

It's still a bad idea to use it to pester visitors to your site.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic
americast but from India   Redirect into new tab   Aug 1 2012, 04:56 AM
pandy   What happens now? Nothing or does it open a new wi...   Aug 1 2012, 07:17 AM
Christian J   Some browsers ignore onunload events due to widesp...   Aug 1 2012, 08:48 AM
pandy   Yeah, I can't get it to work in Iron. But I ne...   Aug 1 2012, 09:16 AM
americast but from India   When the window is closed, nothing happens. I trie...   Aug 1 2012, 10:23 AM
pandy   Works for me in FF at least. Sure you haven't ...   Aug 1 2012, 10:42 AM
americast but from India   where have you put the script? Under the <body...   Aug 1 2012, 11:22 AM
pandy   In HEAD.   Aug 1 2012, 02:19 PM
americast but from India   What did you write in place of "_blank"?...   Aug 2 2012, 03:03 AM
pandy   I just removed it. Maybe I don't have the late...   Aug 2 2012, 07:46 AM
americast but from India   Great! On disabling popups, it works fine. But...   Aug 3 2012, 11:13 AM
pandy   So it works now? That's a whole lot more comp...   Aug 3 2012, 11:53 AM
americast but from India   But how?   Aug 3 2012, 12:11 PM
pandy   I'm not sure. I think it would involve event l...   Aug 3 2012, 12:31 PM
americast but from India   Might be they will, because over there I want to r...   Aug 4 2012, 12:09 PM
americast but from India   Have you heard of any command: onexit ?   Aug 5 2012, 03:39 AM
americast but from India   Have you heard of any command: onexit ?   Aug 5 2012, 03:40 AM
pandy   No. But googling javascript + exit or on exit migh...   Aug 5 2012, 05:26 AM
Darin McGrew   Perhaps you're referring to the onclose event ...   Aug 5 2012, 05:12 PM
americast but from India   Can you give a command similar to window.open or w...   Aug 8 2012, 09:28 AM
Darin McGrew   If you could, then I'm sure it wouldn't be...   Aug 8 2012, 09:38 AM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th April 2024 - 08:12 PM