コード例 #1
0
ファイル: MiniBrowser.cs プロジェクト: schifflee/Terminals
        public new void Dispose()
        {
            if (this.internetExplorer != null)
            {
                this.internetExplorer.Stop();
                this.internetExplorer.Dispose();
                this.internetExplorer = null;
                base.Dispose();
            }
#if GECKO
            else if (this.firefox != null)
            {
                this.firefox.Stop();
                this.firefox.Dispose();
                this.firefox = null;
                base.Dispose();
            }
#endif
        }
コード例 #2
0
ファイル: MiniBrowser.cs プロジェクト: RSchwoerer/Terminals
 public new void Dispose()
 {
     if (this.internetExplorer != null)
     {
         this.internetExplorer.Stop();
         this.internetExplorer.Dispose();
         this.internetExplorer = null;
         base.Dispose();
     }
     #if GECKO
     else if (this.firefox != null)
     {
         this.firefox.Stop();
         this.firefox.Dispose();
         this.firefox = null;
         base.Dispose();
     }
     #endif
 }
コード例 #3
0
ファイル: MiniBrowser.cs プロジェクト: RSchwoerer/Terminals
        private void InitializeBrowser()
        {
            this.Dispose();

            switch (this.browserType)
            {
                case BrowserType.InternetExplorer:
            		this.SetIsLoading(true);
            		
            		SetBrowserEmulationVersion();
            		
                    this.internetExplorer = new IE
                                                {
                                                    Dock = DockStyle.Fill,
                                                    // Never change this to true
                                                    // There's a bug in IE!
                                                    ScriptErrorsSuppressed = false
                                                };

                    this.internetExplorer.DocumentCompleted += this.WebBrowser_DocumentCompleted;
                    
                    #if IEWORKAROUND
                    dynamic activeXIE = this.internetExplorer.ActiveXInstance;
                    activeXIE.BeforeNavigate2 += new BeforeNavigate2((object pDisp,
						ref dynamic url,
						ref dynamic Flags,
						ref dynamic TargetFrameName,
						ref dynamic PostData,
						ref dynamic Headers,
						ref bool Cancel) =>
						{	
							UrlMkSetSessionOption(URLMON_OPTION_USERAGENT_REFRESH, null, 0, 0);
							UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, IE10, IE10.Length, 0);
    						
							// The following code causes problems with AJAX - please don't resend the headers
							/*
							if (!renavigating)
							{
								const string agent = IE11;
							    Headers += string.Format("User-Agent: {0}\r\n", agent);
							    renavigating = true;
							    Cancel = true;
							    this.internetExplorer.Navigate((string)url, (string)TargetFrameName, (byte[])PostData, (string)Headers);
							}
							else
							{
							    renavigating = false;
							}
							*/        
						});
                   #endif 
                   
                    this.browserContainer.Controls.Add(this.internetExplorer);
                    break;
                #if GECKO
                case BrowserType.Firefox:
                    // Workaround
                    this.SyncCerts();

                    Xpcom.Initialize();

                    // Set some preferences
                    nsIPrefBranch pref = Xpcom.GetService<nsIPrefBranch>("@mozilla.org/preferences-service;1");

                    // Show same page as firefox does for unsecure SSL/TLS connections ...
                    pref.SetIntPref("browser.ssl_override_behavior", 1);
                    pref.SetIntPref("security.OCSP.enabled", 0);
                    pref.SetBoolPref("security.OCSP.require", false);
                    pref.SetBoolPref("extensions.hotfix.cert.checkAttributes", true);
                    pref.SetBoolPref("security.remember_cert_checkbox_default_setting", true);
                    pref.SetBoolPref("services.sync.prefs.sync.security.default_personal_cert", true);
                    pref.SetBoolPref("browser.xul.error_pages.enabled", true);
                    pref.SetBoolPref("browser.xul.error_pages.expert_bad_cert", false);

                    // disable caching of http documents
                    pref.SetBoolPref("network.http.use-cache", false);

                    // disalbe memory caching
                    pref.SetBoolPref("browser.cache.memory.enable", false);                    

                    // Desktop Notification
                    pref.SetBoolPref("notification.feature.enabled", true);
                    
                    // WebSMS
                    pref.SetBoolPref("dom.sms.enabled", true);
                    pref.SetCharPref("dom.sms.whitelist", "");

                    // WebContacts
                    pref.SetBoolPref("dom.mozContacts.enabled", true);
                    pref.SetCharPref("dom.mozContacts.whitelist", "");

                    pref.SetBoolPref("social.enabled", false);

                    // WebAlarms
                    pref.SetBoolPref("dom.mozAlarms.enabled", true);

                    // WebSettings
                    pref.SetBoolPref("dom.mozSettings.enabled", true);
                    
                    pref.SetBoolPref("network.jar.open-unsafe-types", true);
                    pref.SetBoolPref("security.warn_entering_secure",    false);
                    pref.SetBoolPref("security.warn_entering_weak",      false);
                    pref.SetBoolPref("security.warn_leaving_secure", false);
                    pref.SetBoolPref("security.warn_viewing_mixed", false);
                    pref.SetBoolPref("security.warn_submit_insecure", false);
                    pref.SetIntPref("security.ssl.warn_missing_rfc5746",  1);
                    pref.SetBoolPref("security.ssl.enable_false_start", false);
                    pref.SetBoolPref("security.enable_ssl3",             true);
                    pref.SetBoolPref("security.enable_tls", true);
                    pref.SetBoolPref("security.enable_tls_session_tickets", true);
                    pref.SetIntPref("privacy.popups.disable_from_plugins", 2);

                    // don't store passwords
                    pref.SetIntPref("security.ask_for_password", 1);
                    pref.SetIntPref("security.password_lifetime", 0);
                    pref.SetBoolPref("signon.prefillForms", false);
                    pref.SetBoolPref("signon.rememberSignons", false);
                    pref.SetBoolPref("browser.fixup.hide_user_pass", false);
                    pref.SetBoolPref("privacy.item.passwords", true);

                    this.firefox = new GeckoWebBrowser {Dock = DockStyle.Fill, AllowDrop = true};
                    this.SetIsLoading(true);
                    this.firefox.DocumentCompleted += this.FireFox_DocumentCompleted;
                    this.browserContainer.Controls.Add(this.firefox);
                    
                    break;
                #endif
            }

            
        }
コード例 #4
0
ファイル: IE.cs プロジェクト: RSchwoerer/Terminals
 public WebBrowser2EventHelper(IE parent)
 {
     this.parent = parent;
 }
コード例 #5
0
ファイル: IE.cs プロジェクト: schifflee/Terminals
 public WebBrowser2EventHelper(IE parent)
 {
     this.parent = parent;
 }
コード例 #6
0
ファイル: MiniBrowser.cs プロジェクト: schifflee/Terminals
        private void InitializeBrowser()
        {
            this.Dispose();

            switch (this.browserType)
            {
            case BrowserType.InternetExplorer:
                this.SetIsLoading(true);

                SetBrowserEmulationVersion();

                this.internetExplorer = new IE
                {
                    Dock = DockStyle.Fill,
                    // Never change this to true
                    // There's a bug in IE!
                    ScriptErrorsSuppressed = false
                };

                this.internetExplorer.DocumentCompleted += this.WebBrowser_DocumentCompleted;

#if IEWORKAROUND
                dynamic activeXIE = this.internetExplorer.ActiveXInstance;
                activeXIE.BeforeNavigate2 += new BeforeNavigate2((object pDisp,
                                                                  ref dynamic url,
                                                                  ref dynamic Flags,
                                                                  ref dynamic TargetFrameName,
                                                                  ref dynamic PostData,
                                                                  ref dynamic Headers,
                                                                  ref bool Cancel) =>
                {
                    UrlMkSetSessionOption(URLMON_OPTION_USERAGENT_REFRESH, null, 0, 0);
                    UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, IE10, IE10.Length, 0);

                    // The following code causes problems with AJAX - please don't resend the headers

                    /*
                     * if (!renavigating)
                     * {
                     *      const string agent = IE11;
                     *  Headers += string.Format("User-Agent: {0}\r\n", agent);
                     *  renavigating = true;
                     *  Cancel = true;
                     *  this.internetExplorer.Navigate((string)url, (string)TargetFrameName, (byte[])PostData, (string)Headers);
                     * }
                     * else
                     * {
                     *  renavigating = false;
                     * }
                     */
                });
#endif

                this.browserContainer.Controls.Add(this.internetExplorer);
                break;

#if GECKO
            case BrowserType.Firefox:
                // Workaround
                this.SyncCerts();

                Xpcom.Initialize();

                // Set some preferences
                nsIPrefBranch pref = Xpcom.GetService <nsIPrefBranch>("@mozilla.org/preferences-service;1");

                // Show same page as firefox does for unsecure SSL/TLS connections ...
                pref.SetIntPref("browser.ssl_override_behavior", 1);
                pref.SetIntPref("security.OCSP.enabled", 0);
                pref.SetBoolPref("security.OCSP.require", false);
                pref.SetBoolPref("extensions.hotfix.cert.checkAttributes", true);
                pref.SetBoolPref("security.remember_cert_checkbox_default_setting", true);
                pref.SetBoolPref("services.sync.prefs.sync.security.default_personal_cert", true);
                pref.SetBoolPref("browser.xul.error_pages.enabled", true);
                pref.SetBoolPref("browser.xul.error_pages.expert_bad_cert", false);

                // disable caching of http documents
                pref.SetBoolPref("network.http.use-cache", false);

                // disalbe memory caching
                pref.SetBoolPref("browser.cache.memory.enable", false);

                // Desktop Notification
                pref.SetBoolPref("notification.feature.enabled", true);

                // WebSMS
                pref.SetBoolPref("dom.sms.enabled", true);
                pref.SetCharPref("dom.sms.whitelist", "");

                // WebContacts
                pref.SetBoolPref("dom.mozContacts.enabled", true);
                pref.SetCharPref("dom.mozContacts.whitelist", "");

                pref.SetBoolPref("social.enabled", false);

                // WebAlarms
                pref.SetBoolPref("dom.mozAlarms.enabled", true);

                // WebSettings
                pref.SetBoolPref("dom.mozSettings.enabled", true);

                pref.SetBoolPref("network.jar.open-unsafe-types", true);
                pref.SetBoolPref("security.warn_entering_secure", false);
                pref.SetBoolPref("security.warn_entering_weak", false);
                pref.SetBoolPref("security.warn_leaving_secure", false);
                pref.SetBoolPref("security.warn_viewing_mixed", false);
                pref.SetBoolPref("security.warn_submit_insecure", false);
                pref.SetIntPref("security.ssl.warn_missing_rfc5746", 1);
                pref.SetBoolPref("security.ssl.enable_false_start", false);
                pref.SetBoolPref("security.enable_ssl3", true);
                pref.SetBoolPref("security.enable_tls", true);
                pref.SetBoolPref("security.enable_tls_session_tickets", true);
                pref.SetIntPref("privacy.popups.disable_from_plugins", 2);

                // don't store passwords
                pref.SetIntPref("security.ask_for_password", 1);
                pref.SetIntPref("security.password_lifetime", 0);
                pref.SetBoolPref("signon.prefillForms", false);
                pref.SetBoolPref("signon.rememberSignons", false);
                pref.SetBoolPref("browser.fixup.hide_user_pass", false);
                pref.SetBoolPref("privacy.item.passwords", true);

                this.firefox = new GeckoWebBrowser {
                    Dock = DockStyle.Fill, AllowDrop = true
                };
                this.SetIsLoading(true);
                this.firefox.DocumentCompleted += this.FireFox_DocumentCompleted;
                this.browserContainer.Controls.Add(this.firefox);

                break;
#endif
            }
        }