473,466 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to redirect when a page close using onunload in body tag?

127 New Member
when the tab or the browser is closed the javascript should automatically redirect to the logout page.

Expand|Select|Wrap|Line Numbers
  1. <body onUnload="window.open('logout.php')">
  2.  
Expand|Select|Wrap|Line Numbers
  1. <body onUnload= "re();";
  2.  
both methods are not working...

Expand|Select|Wrap|Line Numbers
  1.  
  2. // java script
  3.  
  4. function re()
  5. {
  6. self.location.href = "logout.php"
  7. }
  8.  
when the user closes the window the logout script should excute. but it not working
Nov 8 '10 #1
0 1954

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

Similar topics

1
by: Simon Wigzell | last post by:
I'm using OnUnLoad in my asp web pages body tag because I want to set some values if someone exits the page by means other than using the built in menu or close button. Probem is it is also being...
5
by: Nazir | last post by:
I am trying to do something pretty simple - but can't see how it can be done in ASP.NET. I have an aspx web page with a form which opens up a new window. The web page uses code behind to build...
1
by: Feng | last post by:
Hi, What I need is to run some ASP code on the server, when user close his/her browser. I tried to create a "OnUnload" event handler on client side JavaScript to do a "Submit ()". But that...
3
by: shlomi.schwartz | last post by:
Hi all, I'm trying to create a server side log, that will show how much time a user was present on my web page. I tried using onUnload and onBeforeUnload to do an http call to the server. I've...
1
by: Donkey Cart Racer | last post by:
Hi, I have a page - page1 which opens a window1 where users can look at tasks, in window1 users can click and open window2 where they can create new tasks I want to refresh window1 when...
1
by: tomcarr1 | last post by:
What event is triggered in ASP.Net when you close the browser ? What event is normally used to trigger clean up stuff when going from one form to another or leaving the project?
1
by: vssp | last post by:
hai friends How to paly song when page laod using php code? I my php application when i load the home page automatically pale song Its possible !! ??Please give me any idea Thanks vssp...
7
by: tapanreddy | last post by:
I am looking to perform an action when we close the window using the close tab at the top of the screen. I know how to do it using a close button but I was wondering if there is way to achieve the...
5
by: nic829 | last post by:
I am trying to write a code such that when user close the browser or netvigate to other page, a message box will show up. <SCRIPT> function closeIt() { event.returnValue =...
3
by: =?Utf-8?B?UGF0UA==?= | last post by:
We have a site that gets many requests for nonexistent pages, files and folders. We want those requests redirected to the index page. However, for static files (i.e. images and some other...
0
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,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.