473,748 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Alert not working in IE6 some cases

The following code always prints the debug lines inside the
conditional if statement before and after the alert statement when the
session has timed out, but the alert and redirect only appear/work in
certain situations.

<%
// Check for expired session
log.debug("sess ion ID = " + session.getAttr ibute("session_ loginID"));

if (session.getAtt ribute("session _loginID") == null)
{
log.debug("I am null!");
%>
<SCRIPT>
alert("You have been logged out of the system.\n");

window.top.navi gate("/Login/Logout.jsp");
</SCRIPT>
<%
log.debug("Wher e did the alert go??");
}
%>
Jul 23 '05 #1
2 16861
schieco wrote:
The following code always prints the debug lines inside the
conditional if statement before and after the alert statement when the
session has timed out, but the alert and redirect only appear/work in
certain situations.


Not sure if this will help or not, does it work if you declare the
script as javascript:

<script type="text/javascript">

Jul 23 '05 #2
schieco wrote:
The following code always prints the debug lines inside the
conditional if statement before and after the alert statement when the
session has timed out, but the alert and redirect only appear/work in
certain situations.

<%
// Check for expired session
log.debug("sess ion ID = " + session.getAttr ibute("session_ loginID"));

if (session.getAtt ribute("session _loginID") == null)
{
log.debug("I am null!");
%>
<SCRIPT>
alert("You have been logged out of the system.\n");

window.top.navi gate("/Login/Logout.jsp");
</SCRIPT>
<%
log.debug("Wher e did the alert go??");
}
%>


Since you don't identify under what "certain situations" the alert() appears,
it's impossible to determine your problem. For starters, only IE supports the
navigate() method on the window object, so if its not working in other Web
browsers, that's why.

In the situations where it doesn't work, have you tried View -> Source to
determine what the source looks like in the Web browser? It may not be what you
expect it to be. For example, if the code above is included on every page, but
somehow you've got it specified to be embedded between another <SCRIPT></SCRIPT>
combination on the page, then the nested <SCRIPT><SCRIPT > tags might be the
problem.

Do you receive any Javascript errors or warnings in the Web browser when the
alert() does not appear? (in IE double-click any yellow ! that appears in the
bottom left corner, in Netscape, type "javascript :" into the Address Bar, but as
I've already told you, navigate() won't work in Netscape, so that's the first
thing to fix if it's not working in Netscape).

Without more details, it's impossible to know why the alert() and the redirect
aren't working.

As a complete aside, the way you're doing it isn't the way to do it IMNSHO. Don't
write out an alert() and redirect using client-side technology. Instead, redirect
to "/Login/Logout.jsp?msg= Your+session+ha s+expired" using a *server-side*
redirect.

Then on Logout.jsp, you can do whatever you want with 'msg'. For example
(server-side Javascript):

<%
var msg = Request.value(" msg");
if (msg != null) {
Response.write( '<p><strong style="color:Re d;">' + msg + '</strong></p>');
}
%>

or if you still want to use a client-side alert():

<%
var msg = Request.value(" msg");
if (msg != null) {
Response.write( '<script type="text/javascript">ale rt("' + msg +
'");</script>');
}
%>

But you've completely removed any dependancy on client-side technology to get you
to Logout.jsp in the event the session times out. The user will *always* end up
on Logout.jsp if the session expires, they just may not see your alert() if
client-side Javascript is disabled, which is why I personally recommend using the
<p><strong ...>...</strong></p> (or something similar) design.

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3263
by: amy | last post by:
I have a text box, after user input the value, a validate function trigered. if the value is invalid, alert display, and also set focus back to this control. The alert displays, but when the click the 'OK' in the alert, the set focus to this field does not work. see the code bellow: if (run!="" && IsNumber(run)==false && decimalinputvalid(run,2)==0 )
1
2155
by: Stephanie | last post by:
I am trying to setup a Performance Condition Alert and on this one SQL 2000 Server the 'Type:' drop down does not give me the option to choose "SQL Server performance condition alert". "SQL Server event alert" is the only item listed in the drop down. Is there some setting on the Server that I am missing that needs to be activated? I am connected with the SA account; Windows 2000 sp4; SQL 2000 sp2; SQL Litespeed (this is the only server...
3
2651
by: Darrel | last post by:
I have a page that lists a bunch of items. You can check each item and hit ADD to add these items to a record in the DB. This page has a dropDownList. When you select an item from the list, I want to do an auto-postback and then list a new bunch of items that you can, again, check and click on ADD. If a person has items checked, and then changes the DDL BEFORE cliccking on ADD, I want to pop-up a confirmation 'do you want to add these...
3
9693
by: umdsasha | last post by:
So, basically, I need to detect whether an alert window was thrown. I can't find where it's thrown from but I need to disable a button only if there were no alert windows thrown. Any ideas? Thanks Alex
9
5309
by: Tonio Tanzi | last post by:
I have an asp page with this tag <body onLoad="show_msg('<%=error_msg%>');"> where "show_msg" is a javascript function that shows the message contained in the asp variable "error_msg" only if this variable is not empty. The message is shown using the "alert()" function. The page works good in almost all the case, but some users have reported to my that the alert window don't appear.
4
1950
by: Z1P2 | last post by:
I have this alert that works: <script type="text/javascript"> var monitor = setTimeout("alert('The monitor is working!');",0); </script> </head> But I want to turn the alert message into a multiline alert, and when I do this: <script type="text/javascript">
24
8224
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and seems to have a (tiny) amount overhead since window itself points to the global object, hence, a circular reference. (From everything I am reading, window is just a REFERENCE back to the global object, as opposed to a separate object.)
20
1781
by: Peter | last post by:
I need a popup alert after a post back. 1) user clicks on the submit button 2) Server side code runs and if the result is false I want to display a java script alert("It did not work") How to do I display a popup message after a postback ? Thank You
6
1092
by: codeseeker1 | last post by:
currently iam working with a php code along with ajax. code works properly with an alert box.when alert box is removed,rest of code not working.can anyone help? thanx in advance
0
8979
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8818
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9307
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8234
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6790
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4589
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4860
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.