Solved

Disable JavaScript

Posted on 2001-06-09
4
2,391 Views
Last Modified: 2007-12-19
How can i disable Internet Explorers (4.0/5.0) JavaScript using C++ ?

Does anyone know the registry entrys which i need to change ?
0
Comment
Question by:brain3000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:djbusychild
ID: 6171753
well, do you mean disable javascript for your own app that uses the webbrowser control ? do you just mean disable javascript on IE itself? You can just do that through Tools->Internet Options->Security->Custom Level->Disable Active Scripting
0
 

Author Comment

by:brain3000
ID: 6171769
i like to disable javascrip on ie. and ill do this automatically using cpp code. is there any way other than simulating a keystroke sequence for disabling js ?
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 150 total points
ID: 6175071
I found that I can enable and disable via the reg key:

HKCU\Software\Microsoft\Windows\CurrentVersion\
Internet Settings\Zones\3\1400

and setting DWORD value to 0=enable and 3= disable.

I'm not 100% sure how general this is (it seems to work OK on Win98, but NT or 2K is still a question).  And it has a distinct flaw that it seems to only affect the next *new* IE that you open.

Here is EnabScript.JS (JavaScript) file I keep on my desktop for double click access:

oShell= new ActiveXObject("WScript.Shell")
var DISABLE= 3, ENABLE= 0;
var nRet= oShell.Popup(
  "Do you want Scripting?\n"
  +"Yes to Enable, No to Disable",  0,
  "Enable/Disable IE5 Scripting", 35
);
if (nRet==2) WScript.Application.Quit();  // 2= cancel
if (nRet==6) nNewVal= ENABLE;  // 6 is YES
if (nRet==7) nNewVal= DISABLE; // 7 is  NO

sName=
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\"
+"Internet Settings\\Zones\\3\\1400"

oShell.RegWrite(sName, nNewVal,"REG_DWORD" );

WScript.Application.Quit();  

-- Dan
0
 

Author Comment

by:brain3000
ID: 6177873
thanks for this answer. i tried on my win2k system and it works fine :)
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using Diagnostic tools in VS2015: Unresoved allocations 19 125
FMX TCameraComponent Problem 2 92
designing in object programming 12 104
I could not set window to top 4 40
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question