473,554 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pop up a new window if user abandons a website.

1 New Member
Im needing a script that when a user clicks the "X" (closing the browser) or abandons my site a new small pop up window will appear..

The new small pop up window will ask "Why are you abandoning my site? Did you have any questions .. please let us know.." and then the user has the option to answer it or not.... then submit message or totally close the new window and main window..


I know the "window.clo sed" is the key but I dont know how to use it .. I checked on the internet but no information nor samples of it...

thanks..
Sep 11 '07 #1
5 1281
dmjpro
2,476 Top Contributor
Im needing a script that when a user clicks the "X" (closing the browser) or abandons my site a new small pop up window will appear..

The new small pop up window will ask "Why are you abandoning my site? Did you have any questions .. please let us know.." and then the user has the option to answer it or not.... then submit message or totally close the new window and main window..


I know the "window.clo sed" is the key but I dont know how to use it .. I checked on the internet but no information nor samples of it...

thanks..
Welcome to TSDN.
Try this, it will work.

Expand|Select|Wrap|Line Numbers
  1. window.onbeforeunload = function(){/*Your code goes here*/}
  2.  
Good Luck!
But mind it, it will work in Opera.

Kind regards,
Dmjpro.
Sep 11 '07 #2
rohitchawla
85 New Member
u can try something like this

Expand|Select|Wrap|Line Numbers
  1. window.onbeforeunload=function(){ 
  2. my_win=window.open("", "mywindow1","width=350,height=150");
  3. my_win.document.write(/*write ur code here*/)
  4. };
  5.  
Sep 11 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
youtubers, just a word of warning. While the suggestion may work in most modern browsers, it is extremely annoying. If the user decides to leave your website, it's generally good practice to let them leave. If you don't and pester them with a popup, they are more than likely to abandon your website for good (never to return again).
Sep 11 '07 #4
rohitchawla
85 New Member
the window.onbefore unload event will be fired also when user refreshes the page
Sep 11 '07 #5
pbmods
5,821 Recognized Expert Expert
Heya, Tubers.

Beware of popup blockers!

The average attention span of an internet User is maybe 5 seconds. If you're noticing a lot of unique-but-onetime visitors in your server logs, then your site has nothing that is 'grabbing' your Users' attention.

Direct feedback would be nice, but you're not going to get it that way.
Sep 11 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

60
7221
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm The detector requires javascript 1.0 to work. This translates to netscape 2.0 and IE 3.0 (although maybe IE 2.0 also works with it)
6
12960
by: Tony G. | last post by:
Hi there, I have an APS 3 application, running on a Windows 2003 Web edition server - it is a very busy website, and when users are click on certain links (membership info), a new window i opened via javascript. This new window is on the SAME website as where the user is located, but just opened in HTTPS (secure) mode - the user can now...
14
37138
by: Frances Del Rio | last post by:
I'm trying to open a url in a new window while pg loads (but NOT in a pop-up..) I need to do sthg like // while pg is loading.. window.location ='page.html' // but I need this to open in a new blank window.. // (NOT in a pop-up, a regular new window..) can you do this?? thank you..
4
2197
by: ...D. | last post by:
OK. I am halfway decent with HTML. Now I want to try javascript for some things that HTML cannot do. I have looked over a tutorial & all. What I want to do is create a button, that when pressed, closes the window it is in, and launches a URL. The window the button is in is actually just a sub-page of the main website page, launched with...
20
10997
by: Geoffrey H. Goldberg | last post by:
I have made a remote control window which opens from its parent. On loading, the remote is positioned relative to the screen using window.moveTo(x,y). What I would like to happen is the remote control to open docked in a specific location relative to the parent (opener). Fortunately, I need this to work ONLY in IE, so at least I don't...
2
4825
by: trialproduct2004 | last post by:
Hi all i am having problem in html page. I have two html page one containing link to other. I am using href to display new page and using target as _blank. I want to open new page in maximized mode. But new page is getting opened in restore mode. Can someone tell me how to open new page in maximized mode. Please help me. Thanks in advance.
4
4923
by: gimme_this_gimme_that | last post by:
Hi, This is sort of a : How to build a Yes/No dialog box qquestion. Or perhaps a question about getting javascript variables from a pop-up window and processing them on a submit. This is what I'd like to have happen :
5
1546
by: James Coleman | last post by:
I have to send a user to a 3rd party site. Basically I am thinking I need a linkbutton with an onclick event. The even handler would populate the necessary values (userid, encryptedid, usergroup) and then I need to post this information to a 3rd party site (in a new window). From the user perspective: User clicks on a hyperlink and a new...
6
18208
by: mistral | last post by:
what is correct way open a PDF document in new window use hyperlink? I want show images thumbnails linked with PDF files, when click on thumbnail, PDF will be opened in new window. Some of PDF files are in the same web server, other are in a remote location. Any help will be appreciated.
0
7611
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7812
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7894
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5162
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3579
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2026
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.