Disable Back Using Javascript
Mar 15, 2006I want to know, is there any other methods other than history.forward(), to disable back operation in HTML using javascript.
View 1 RepliesI want to know, is there any other methods other than history.forward(), to disable back operation in HTML using javascript.
View 1 RepliesI have a form in which I disable the backspace key from going back a page if typed.
It works in IE I can disable the backspace key from going back but not in mozilla. Does anyone know why this does not work in mozilla?
<body onkeydown="if (event.keyCode==8) {event.keyCode=0; return event.keyCode }">
I would like to disable the back button in IE7 and IE8. I assume the best way is to use window.open. I tried below and it disabled the IE back button but doesnt show the menu items, url bar etc.
Code:
<a href="#" onClick="window.open(theURL, 'newpage.html', 'fullscreen=yes, scrollbars=auto')">go to page with disabled IE back button</a>;
I am writing a prgram in php.when i click "log out "button ,it redirects to my first page "index.php".(username & password)and then by clicking back button in the browser ,it showing all my previous pages that i visited.I want to disable back button in the browser (javascript should support in all browser) using javascript or php
View 3 Replies View RelatedIn my web application(ASP.net), i need to disable the "Back" button in the browser.Moreover i also need to disable the Backspace key in my keyboard when my web page is run..How to do it with javascript..?
View 9 Replies View Relatedi have a form being filled. i don't want the user to be able to submit twice. how can i either prevent the user from going back or disable the submit button?
i am currently disabling the submit button but when the user clicks back(from the next page) it asks whether it should resend data. when the data is resent it loads the original version of the page(without submit disabled).
I have a form with some text fields that are disabled UNLESS a checkbox is checked. Initially the text fields are disabled and the checkbox is unchecked.
The code is something like this:
Code:
function disableTextbox() {
if (chk.checked) {
txt.disabled = false;
} else {
txt.disabled = true;
}
}
<form action=something.cfm>
<input type=checkbox name=chk onclick=disableTextbox();>
<input type=text name=txt disabled>
<input type=submit>
</form>
When the form is submitted, some validation is performed. If anything fails, I display an error message and show a link to go back (history.back).
The problem that I am having is that when you click on the link to go back, the checkbox on the form is checked, but the text fields are disabled.
You have to re-click the checkbox to update the text field.
I want to disable all the option, which inlcude:
using right click and select back,
pressing the backspace button on keyborad
and the back option on above menu to be disabled.
and other ways of going back to previous page.
Is there a way to do that using JS.
How can I make this code disable the submit button once it has been pressed, then if the user hits back or GOES back, it will re-enable it again?
<SCRIPT LANGUAGE="JavaScript" TYPE="text/JavaScript">
function formControl(submitted)
{
[code]....
I'm attempting to use the javascript 'history.go(-1);' to make a page automatically return to the last page a user visited. At the moment, I can get this to work ONLY if I insert a link into the page.
What I want to happen is, the page autmatically sends the user back to the previous page after a set time. I have this for my JS:
function backtomusic() {
window.location = history.go(-1);
}
And in the body section of my page I have:
<body onLoad="setTimeout('backtomusic()', 3000)">
When it runs I get an error saying 'undefined' in the browser address bar
Any ideas?
I am doing a javascript back button within my form
<input type=submit value="Back to previous page" class=header onClick="history.go(-1)">
for some reason it is submitting the form instead of going back a page --
why would this be?
Does anyone know of a javascript that will allow a visitor to go back two pages? I've tried this but it will just go back one page.
<input type="button" name="back" id="back" onclick="history.back(-2);" value="Go back" />
Can someone show me how I can have:
<a href="javascript:history.back()" name="Back" value="Back"
style=width:40px;float:right;margin-left:0px class="button" >Back</a>
but since this href exists in a frame, it only pertains to this frame?
I have a page where users can filter a list of links using javascript clicks. The user then clicks a link in that list, views the page and then clicks back on the browser to view the rest of the list but the javascript options they filtered in the list are gone resulting in them having to do it all over again. Is there a solution to this?
Would it work if I store their selections in a cookie each time they click a javascript button and then when they visit a link and click back (to what is presumably now a cached page) will I be able to have javascript that will read the cookie and reset their options again or is the cookie not loaded on a cached page?
Are there any common solutions to this kind of thing?
Yes, I would like thoughts on how to intentionally commit web usability sin and "break the back button" but please don't freak out on me yet. I've had quite a few years of experience in web development at this point and I understand the need for usability. This is precisely why I need to disable the back button, or at least make people need to think before they use it. Its a service to the end user in this case & an attempt to prevent them from making a mistake.
I am currently working on a web application that is almost entirely AJAX. (Lets save the "is AJAX worth the hype" discussion for another thread. It has its place & I'm not using it trivially.) It is designed in such a way that it is intended to function as a desktop application, and, other than the fact that it is on the web & rendered in HTML/JS, it really bears no resemblance to a traditional "web site". There aren't "pages" and a "history", there is just a user interface used to manipulate the data and update the view. All the different views occur on a single page, just as any single window desktop application would.
Now the problem: Because its being developed to run in a browser, people will still have the "web site" mentality, not understanding the huge difference between "web application" and "web site". If they do open a new view and then want to go back to what they were previously looking at, they will want to hit the back button, but in the context of this app, that may seriously goof them up, even resulting in loss of work.
Example: Lets say that a user opens "data_entry.asp" and does some work. They then fill out a form but need to look up some information. They click a "Look Up" sort of button to get the information they need. When they click it, the data entry form is hidden (note that their data entry is unsaved, but perfectly safe since it is still on the page) & replaced with the info search form which uses AJAX to perform their search. Now to get back to their form, they SHOULD click the "close" button, which just re-displays the data entry form, but they've been conditioned to hit "back". When they do this they will go back to the page they were on before, resulting in the loss of everything they entered on the form.
So what I need to do at least is alert them hen they click the back button "Hey, you're about to leave this page, but there's really no reason to do that unless you're really done." & give them the chance to back out of using the back button (no pun intended).
Anyone have any idea how to disable the back button, or have any idea how to tackle the problem at hand. I don't want to revert to using separate pages and having to store temporary data to re-populate forms. In this kind of app thats a lot of extra & unnecessary work.
Okay, so I've just installed a javascript that redirects to any random page from a specified list. The problem with it is, it's in an iframe and works as sort of an advertising area. So on the mainpage where the iframe has been placed, whenever someone uses the back button, it just keep going back in the iframe and choosing random pages. The back button doesn't work on the mainpage and instead is used in the actual iframe.
I'm not sure if this is a problem with the iframe or the script, and I don't think I have the mental capacity to figure it out so I'd really value some help! Oh, and apparently the problem doesn't occur when using Firefox. Code:
I want to test/proof some <NOSCRIPT></NOSCRIPT> stuff in my page via PHP but can not figure how to disable JavaScript on my browser.
View 2 Replies View RelatedI've browsed through past usenet archives, but can't seem to come across quite the javascript I'm looking for. I'm looking for a simple javascript that will display the date as such:
May 17
So basically, just displaying the current month and the current date. But I would also like the ability to backdate by one day, two days, etc.. So the next date might look as such:
May 15
Which would be two days earlier than today's date, but in keeping with the same format.
The following script is supposed to have high categories as radio buttons and mid categories as check boxes. Clicking the radio button is supposed to select all checkboxes under it and submit the form.
RADIO (ID = 0001-1 VALUE="")
CHECK (ID=0001-0011)
CHECK (ID=0001-0012)
RADIO (ID = 0001-2 VALUE="")
CHECK (ID=0001-0021)
CHECK (ID=0001-0022)
The code appears to be checking and unchecking the correct checkboxes. But when the submit occurs, the buttons that were unchecked become checked again.
function handleHighCatSelect(obj)
{
var highCatName = obj.name;
var highCatNameInMidCat = highCatName.substring(0,5) + "00" +
highCatName.substring(5,6);
alert(highCatName);
var length = document.frm.elements.length;
for (var i=0;i<length;i++)
{
var formObj = document.basicSearchMFSFrm.elements[i];
var currName = formObj.name;
var currValue = formObj.value;
if ((formObj.type == 'radio' || formObj.type == 'checkbox')
&& (currName.indexOf(��-') != -1) )
{
if ((currName.indexOf(highCatNameInMidCat) != -1) ||
(currName == highCatName ) )
{
formObj.checked = true;
}
else
{
formObj.checked = false;
}
}
}
frm.submit();
}
Basically, I have a page that I load with 10 input fields. If users
have JS enabled I want to hide 5 of these fields so as to reduce
clutter. If the user needs these extra fields an "Add" button can be
used to display the hidden fields one by one.
Once the fields a filled in the user submits them for validation and
if there are any error They can "Go back" to make some changes. The
whole process works great in FF & Opera but IE lets me down because if
you use the Browser "Back" button the Javavscript gets executed even
though it should be loaded out of cache.
I'm having an array dynamically fetched from the database using php, in result, I'm getting a check box, with their corresponding value.
I wanted to make a javascript function so that if I uncheck a checkbox, corresponding value disappears.
Before going to the looping, I was trying to do a simple check - like this -
function checkOtherValues() {
if (document.myform.checkmember[0].checked==false) {
document.myform.checkvalue[0].value="";
}
}
I thought this should work, but I'm getting the following error -
document.myform.checkmember.0 is null or not an object For the form, it's set in this way -
<input type="checkbox" name="checkmember[]" value="<?=$chmember[$i]?>" onClick="return checkOtherValues()">
<input type="text" name="checkvalue[]" size="5" value="<?=$chvalue[$i]?>" />
I have a form, with two drop down boxes. I want to be able to disable
the second drop down box when a specific value is chosen on the first.
I can't seem to figure out how to do this.
Go easy on me, I'm a newbie for the most part, but here is my code...
Does anyone know how to disable javascript in the new Netscape 8 -- for
off line testing (like can be done readily with the current MSIE,
Firefox or Opera browsers) ?
When I try tools -> options -> site controls -> web features and check
or uncheck the 'enable javascript' box, nothing changes -- it stays
enabled.
I've searched FAQs, archives and google about the issue, with no luck.
The odd thing is I swear last summer I managed past the problem
intermittently by clearing the cache, restarting the program, rebooting
the system, or something like that . . . but then got busy with other
things and now I don't recall what I did -- or if I was dreaming.
If no-one else can disable javascript on NN8, then why worry? I don't
know -- to be thorough, I guess. Would a third party security program
'disable javascript' feature be a way to test NN8 under these
circumstances? Or maybe it's the case that the 'disable javascript'
controls in NN8 work only for online content (the reverse of the MSIE
controls). I'll check it out and report back.
If the browser disable the javascript, what happen to Ajax? can i slove
the problem by using server side script? any suggestion for this?
i currently do some dirty projects with perl/cgi, and I would like to
add more client side features which relate to ajax, and do some
validation on the client side with javascript. but it is possible that
the javascript may be disable with some browsers. what can i do if the
client's broweer disable the javascript.
I want to disable a table with javascript. In this table i have 'n' record and each record has 3 buttons. If you click a button does an action. I want to disable the all table.
Is there any way to disable all this table without have to disable each
button of each record?
Is there anyway of disabling images in javascript, so that the alternative
text appears instead of the images? I'm trying to do a text-only version of my site.