Solved

Disable JavaScript

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

710 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