HI ALL
i have blocked F5 properties ,but i am getting javascript error has access denied where as cursor plased in input type file .
plz help me

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function funtest(event,obj){
var test=window.event.keyCode;
if(test=='116')
{
window.open('t.php',height=300,width=300);
window.event.returnValue = false;
window.event.cancelBubble = true;
window.event.keyCode=0;
return false;
}
else
{
document.getElementById(obj.id).value='';
return false;
}
}
</SCRIPT>
</HEAD>
<BODY >
<form>
<table>
<tr>
<td>file</td>
<td><input type="file" id='from1' name='from1' onkeydown='funtest(event, this)'></td>
<tr>
<td>text</td><td><input type='text' id='form2' name='form2' onkeydown='funtest(event,this)'>
</td>
</tr>
</table>
</form>
</BODY>
</HTML>

You should not have the right to block any function of a browser. This belongs to the user, NOT TO YOU.

I am totally SICK of greedy webmasters who want to control the computers of the people who visit their pages.

You should not have the right to block any function of a browser. This belongs to the user, NOT TO YOU.

I am totally SICK of greedy webmasters who want to control the computers of the people who visit their pages.

And I'm sick of people who assume that everyone doing web-development is a webmaster writing web pages. There are a very great number of people here who are developing web-based applications, which are totally different from web-pages and have to cope with many more concerns than your average web-page. Remember this is 2008, not 1998. I'm currently developing a very complex spreadsheet-like application (using GWT) and pressing F5 is something that is totally inappropriate. And in fact it is actually the end users who have asked me to disable or modify the F5 behaviour! So I'd suggest if you don't have a sensible answer then you keep quite rather than being abusive to those of us who are pushing the boundaries of what can be done using web-based technologies. Remeber it's 2008, not 1993, and I think everyone knows now that on a normal web-page the user is in charge. But for web-apps it's a different story. So every question is valid and worthy of a respectful answer...

Anyway, this link might help answer the question:
here

This is a legal matter. The year doesn't matter. Our property rights should be the same in any year. You do not have any right to modify the behavior of any computer you do not own. That includes any web user who accidentally lands on your page. The key legal point is obtaining the permission of the owner of the computer.

If you find a way to disable f5 on someone's computer without their permission, then someone else can use what you find to disable a key on my computer without my permission. This is depriving me of my property rights.

If the users want to create redirections of f5 on their OWN computers, that's another matter. That can be done with available software that redefines keyboard keys. And if the company owns the computers, the company can modify them individually. Or you could provide software the user can download and then voluntarily run to effect the changes.

Alternately, if your application is a server-side application, you can modify it on the server so it does not respond to the f5 key, or write a filter that looks for the command from the browser and eats it.

Administrator policies can be used on company owned computers to disable this key.

The problem you really have is that this key is part of Windows and the browser, not part of your program. To make this modification, you have to alter the software the user has on his computer. This can cause numerous problems, including a violation of the user agreement with Microsoft. And it is considered to be illegal hacking.

It is also a web security violation.

IE has a nonstandard extension to JavaScript that redirects keys on the current page. Other browsers do not have this. But it does not redirect the refresh button (if that is the reason you want to disable f5).

This is a legal matter. The year doesn't matter. Our property rights should be the same in any year. You do not have any right to modify the behavior of any computer you do not own. That includes any web user who accidentally lands on your page. The key legal point is obtaining the permission of the owner of the computer.

If you find a way to disable f5 on someone's computer without their permission, then someone else can use what you find to disable a key on my computer without my permission. This is depriving me of my property rights.

If the users want to create redirections of f5 on their OWN computers, that's another matter. That can be done with available software that redefines keyboard keys. And if the company owns the computers, the company can modify them individually. Or you could provide software the user can download and then voluntarily run to effect the changes.

Alternately, if your application is a server-side application, you can modify it on the server so it does not respond to the f5 key, or write a filter that looks for the command from the browser and eats it.

My point, actually, is that your reply was not only unhelpful but also downright rude.
Aside from that I understand what you are saying. It's not correct though, because the users are using my application, not the browser. The browser is merely hosting my application and I am not modifying it's behaviour, in fact what I'm doing is ensuring my application will behave as the user expects. I need to capture the F5 key so that it does a sensible refresh operation in the context of my application, and this includes blocking the refresh action entirely in some cases. The big point here is that a) I'm not modifying their computer or their software, but using a feature of the javascript language that allows me to control what happens within my app, and b) the users are actually not using the web-browser - they are not browsing the web, but they are using my application. Often, they won't be even be aware that it's hosted in a web browser. This also means they wil not accidentally 'land on my page' - it's not a page it's an application. It's on a corporate intranet, they have to log-in, and they have to attend a very-expensive training course. Also, why do you keep banging on about disabling the key? I'm not disabling the key - the key still works, IE still picks up the key press and let's my javascript handle it, exactly as it's supposed to. And in case you haven't noticed in windows and any other o/s its up to the application to handle and process the key press. Sure, ie and a bunch other microsoft apps use F5 for refresh, but plenty of others don't which doesn't mean it's disabled, or that I've changed the behaviour. if I write an application that doesn't respond to F5 I haven't disabled it, I'm just ignoring it, and that's exactly what's happening here. Permission of the user doesn't even come into it because I'm neither disabling the key, nor changing the behaviour of their system.

The other thing you suggest, that is that the user/corporate IT should use some tool to modify F5 is different, and is exactly what you are preaching against so you seem to be contradicting yourself. I agree with you entirely that it's wrong to change how a user's machine works, and it's wrong to deprive people of the expected functionality, but (as a usability expert) I know that it's far preferable that may application is capable of doing something sensible when they press F5 rather than refreshing the web-page that is hosting my app.
The point about the year (do I really have to explain this, how dumb are you?) is that in 1998 there were very few web apps, and your original objection to the question would have held more weight then. In those days virtually all web-browser use would have been surfing, not running apps, and likely a question about blocking F5 would have been from a selfish web-master. But now, in 2008, web-apps are prevalent and selfish web-masters are few and far between, in my experience. It's been a number of years since I encountered a web page that messed about with my browser history, or maximized by browser without asking, or did anything else that I didn't want it to do.
So the year does matter - things have changed and in 2008, in the current environment of web-based-applications, Web 2.0, and so on, it's very reasonable to expect developers to want to exercise maximum control over the environment in which they are forced to deploy their applications. In short, you were wrong to react so rudely to the original question - maybe next time if you want to make a point (which is correct in certain contexts but not all) you should phrase it more diplomatically and without insulting people who may have a very good and legitimate reason for doing it.
Regards,
sparky d.

You do not have any right to modify the behavior of any computer you do not own. That includes any web user who accidentally lands on your page. The key legal point is obtaining the permission of the owner of the computer.

Oh, yes, well in my case, given that the owner of the computer is paying several hundred thousand dollars for the software I'm providing, and signing a very-fat legal agreement covering software, support, consultancy, and training, I think the aspect of obtaining permission is probably covered. But of course, the guy who asked the original question may not be so lucky, so you were probably right to shout him down rather than answering his question, or keeping quiet :)
Regards,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.