473,385 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

checking for back button in JS- what text to search for?

I want to check to see if the user uses the back button to exit our
site. I want to stop running certain functions if they leave our site
via a back button.

I am a real newbie for JS and have a limited knowledge or Regular
Expressions.

my code to check for the urls is:
var test_url=/(www.url1.com)|(www.url2.com)|(history.go)/i;

where history.go is my best assumption of code that would identify the
url the browser sees. Doesn't work though. I RTFM'd, I checked
google, I'm not getting this to work.

can anyone post a response here?

thanks!

Don

Jul 23 '05 #1
4 1232
bb*****@hotmail.com wrote:
I want to check to see if the user uses the back button to exit our
site. I want to stop running certain functions if they leave our site
via a back button.
Give up. You will fail in the end.
I am a real newbie for JS and have a limited knowledge or Regular
Expressions.

my code to check for the urls is:
var test_url=/(www.url1.com)|(www.url2.com)|(history.go)/i;

where history.go is my best assumption of code that would identify the
url the browser sees. Doesn't work though. I RTFM'd, I checked
google, I'm not getting this to work.
You have no way of knowing how I left your site, only that I left it.
And that I left it is not even true. If I open your site, navigate 3
pages deep, bookmark the page, go back to the homepage and hit the
bookmark, I will "stay on your site" but the home page has no way of
knowing that.
can anyone post a response here?
Where else would it be posted?
thanks!


Welcome

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
rf
"Randy Webb" <Hi************@aol.com> wrote
I want to check to see if the user uses the back button to exit our
site. I want to stop running certain functions if they leave our site
via a back button.
Give up. You will fail in the end.

You have no way of knowing how I left your site, only that I left it.


You have now way of knowing if I *did* leave your site.
Jul 23 '05 #3
Randy Webb wrote:
[...]
You have no way of knowing how I left your site, only that I left it.


... or only that you stopped interacting with it.

--
Zif
Jul 23 '05 #4
They're all correct. There is no method in JavaScript to determine
which browser application buttons have been pressed.

Jul 23 '05 #5

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

Similar topics

2
by: shank | last post by:
I use ASP to check users data they submit. In particular, I'm checking for credit cards and I also use a server component DynuCreditCard. It basically affirms that the number "could be" a real...
2
by: William Morris | last post by:
Apologies in advance for the cross-post. Not sure if this is better handled in ASP code or TransactSQL. Windows2000 Server SQL 2000 tblPeople contactid int firstname varchar(25) lastname...
8
by: Galahad | last post by:
Here's the question: I have a form w/ TextBox controls and a Search Button control. Once the user clicks the Search Button, they get a Modal dialog w/ a datagrid that contains their search...
8
by: Jack Addington | last post by:
I want to scroll through the alphabet in order to scroll some data to the closest name that starts with a letter. If the user hits the H button then it should scroll to the letter closest to H. ...
3
by: Penny Bond | last post by:
Hi, Any help or suggestions on this one would be gratefully appreciated: I have 2 aspx pages one is called 'Query' and the other 'Details'. Query page has a number of text boxes and drop...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
4
by: bendlam | last post by:
I have a page that contains search criteria and when you click on the search button it causes a post back that populates a dataview on the same page. One of the gridview columns contains a link...
4
by: phpmel | last post by:
Hi guys, It's been a along time. Hope someone can help me. I am using VS 2005 and language C# I have some fields on a form 1) an 'AccountNo" drop down list and an "ALL" check box next to it...
4
by: F159753 | last post by:
I have the following code: <script type="text/javascript"> function displayRow(){ var ET = document.getElementById("ExpenseTable"); var row3 = document.getElementById("searchbutton"); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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,...
0
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...

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.