Solved

Disable JavaScript

Posted on 2001-06-09
4
2,382 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
  • 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now