473,503 Members | 1,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting URL

5 New Member
I was wandering if someone tryped a URL to live a page

can i have a alert saying

"you are going to XX-PageName-XX"


Thanks
Feb 6 '07 #1
4 1430
acoder
16,027 Recognized Expert Moderator MVP
Welcome to The Scripts.

I don't think that is possible. If the user decides to leave the page of their own accord by typing the URL in the address bar, then you should have no control over that.

What you can do is control the links on your own page. They can all run some javascript which displays the alert and then transfers the user to the new page.
Feb 6 '07 #2
UniDyne
18 New Member
You can trap the onunload event in Firefox and do it using some very Firefox-specific code, but otherwise it is impossible. It opens up a whole can of worms with privacy anyway.
Feb 7 '07 #3
dmjpro
2,476 Top Contributor
yes he is right ...
try this code..................
Expand|Select|Wrap|Line Numbers
  1. <body onunload = test()>
  2. function test()
  3. {
  4.  alert('Page navigation is not allowed');
  5.  document.location.href = the_previous_URL;
  6. }
Code in tags - moderator

best of luck

i am online
Feb 8 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
try this code..................
Expand|Select|Wrap|Line Numbers
  1. <body onunload = test()>
  2. function test()
  3. {
  4.  alert('Page navigation is not allowed');
  5.  document.location.href = the_previous_URL;
  6. }
That is bad practice - preventing the user from leaving a page. The most you should do is ask for confirmation ("Are you sure you wish to leave this page?") though I disagree with that too unless you have a web application and the user has unsaved changes.
Feb 8 '07 #5

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

Similar topics

2
6883
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
5
1880
by: Francis Bell | last post by:
I just found that my fin stream is not getting passed to my readInASpinnerbait function. Here's what I have: string readInFirstChars(ifstream &fin) { char first; string print; while...
8
9986
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
0
2208
by: Si | last post by:
I'm writing an HttpModule to intecept web method calls and retrieve custom authentication information from their SOAP headers. I have the httpModules tag in web.config and that appears to be...
3
3672
by: dei3cmix | last post by:
Hey, I am having a problem with a program I am working on. Basically, the first part of the program gets input from a file using cin.getline. Then the second part, (still in the same main as the...
32
4961
by: paul | last post by:
HI! I keep on getting this error and I have tried different things but I am not sure how to send the expiring date. The error that I am getting in Firefox 1.5 is "Error: expires.toGMTString is...
2
4202
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed...
4
4459
by: R.Manikandan | last post by:
Hi In my code, one string variable is subjected to contain more amount of characters. If it cross certain limit, the string content in the varabile is automatically getting truncated and i am...
4
5683
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
0
7188
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
7313
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...
0
7441
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
5558
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,...
1
4987
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
4663
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...
0
1489
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 ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
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...

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.