Posted By

stoyan on 08/07/09


Tagged

ie script c registry


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


IE registry setting to prevent "Stop running this script?" messages


 / Published in: C#
 

*IE7 sometimes complains that a JavaScript script is running too slow and asks the user whether they want to terminate it or continue. *To get rid of this annoying popup a few changes need to be made to the registry. *ref: http://www.itwriting.com/blog/119-ie7-script-madness.html

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Microsoft.Win32;
  6.  
  7. namespace RegistryUpdateForIEScriptProblem
  8. {
  9. class Program
  10. {
  11. /// <summary>
  12. /// IE7 sometimes complains that a JavaScript script is running too slow and asks the user whether they want to terminate it or continue.
  13. /// To get rid of this annoying popup a few changes need to be made to the registry.
  14. /// ref: http://www.itwriting.com/blog/119-ie7-script-madness.html
  15. /// </summary>
  16. /// <param name="args"></param>
  17. static void Main(string[] args)
  18. {
  19. RegistryKey RegKeyWrite = Registry.CurrentUser;
  20. RegKeyWrite = RegKeyWrite.CreateSubKey(@"Software\Microsoft\Internet Explorer\Styles");
  21. RegKeyWrite.SetValue("MaxScriptStatements", 1000000000);
  22. RegKeyWrite.Close();
  23.  
  24. RegistryKey RegKeyRead = Registry.CurrentUser;
  25. RegKeyRead = RegKeyRead.OpenSubKey(@"Software\Microsoft\Internet Explorer\Styles");
  26. Object regSuccessful = RegKeyRead.GetValue("MaxScriptStatements");
  27. RegKeyRead.Close();
  28.  
  29. Console.WriteLine("IE7 will no longer complain about scripts running too slow");
  30.  
  31. Console.ReadLine();
  32. }
  33. }
  34. }

Report this snippet  

You need to login to post a comment.