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
Solved

Disable JavaScript

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
  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 …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

809 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