Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 934364 - Last Review: November 22, 2007 - Revision: 1.2
You may receive an "Access is denied" error message when you try to access a Web page that contains a script in Internet Explorer 6
Consider the following scenario:
- You have a computer that is running Microsoft Windows XP with Service Pack 2 (SP2) or Windows Server 2003 with SP1.
- You try to access a Web page in Microsoft Internet Explorer 6.
- The Web page contains a script.
In this scenario, you may receive the following error message:
Line: Line_Number
Char: Character Number
Error: Access is denied
Code: 0
URL: file:/// URLPath/Filename
The following line in the script code raises the error message.
This problem occurs when you try to access a Web page from the local file system, and the local file system contains the
event.KeyCode property in the script. This is a security change in Internet Explorer 6 on Windows XP with SP2 and on Windows Server 2003 with SP1. You can no longer access the
event.keyCode property by using the SHIFT key or the CTRL key on Web pages that are loaded from the local disk.
To resolve this problem, change the code that assigns the
event.keyCode property so that it does not change the value. The change in the code lets you use the SHIFT key or the CTRL key to load pages from the local disk
Alternatively, you can host the Web pages on a Web server. This makes sure that the
event.keyCode property in the script runs correctly.
This behavior is by design.
Steps to reproduce the problem
- Install Windows XP with SP2 or Windows Server 2003 with SP1.
- Paste the following code in a text file, and then save the file as TestKeyCode.htm on the local hard disk.
<HTML>
<HEAD>
<SCRIPT>
function onJScriptKeyDown()
{
event.keyCode = 0;
}
</SCRIPT>
<HEAD>
<BODY>
Test
<INPUT onkeydown="onJScriptKeyDown();"
</INPUT>
</BODY>
</HTML>
- Open the TestKeyCode.htm file in Internet Explorer 6 by using the file protocol.
For example, type the following address in the Address bar: file:/// C :/TestKeyCode.htm
- Click the Test box to set the focus.
- Press SHIFT or press CTRL.
For more information about the
keyCode property, visit the following Microsoft Developer Network (MSDN) Web site:
APPLIES TO
- Microsoft Internet Explorer 6.0
- Microsoft Windows XP Professional Service Pack 2 (SP2)
- Microsoft Windows Server 2003 Service Pack 1
| kberrmsg kbtshoot kbfix kbscript kbprb KB934364 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate