Ejemplo n.º 1
0
		///<summary>This event fires when a link is clicked within the webbrowser control which opens in a new window.</summary>
		private void browser_NewWindow(object sender,CancelEventArgs e) {
			//By default, new windows launched by clicking a link from within the webbrowser control, open in Internet Explorer, even if the system default is another web browser such as Mozilla.
			//We had a problem with cookies not being carried over from our webbrowser control into Internet Explorer when a link is clicked.
			//To preserve cookies, we intercept the new window creation, cancel it, then launch the destination URL in a new window within OD.
			string destinationUrl=browser.StatusText;//This is the URL of the page that is supposed to open in a new window. For example, the "ScureScripts Drug History" link.
			if(Regex.IsMatch(destinationUrl,"^.*javascript\\:.*$",RegexOptions.IgnoreCase)) {
				return;
			}
			e.Cancel=true;//Cancel Internet Explorer from launching.
			FormErx browserWindowNew=new FormErx(destinationUrl);//Open the page in a new window, but stay inside of OD.
			browserWindowNew.WindowState=FormWindowState.Normal;
			browserWindowNew.ShowDialog();
		}
Ejemplo n.º 2
0
        ///<summary>This event fires when a link is clicked within the webbrowser control which opens in a new window.</summary>
        private void browser_NewWindow(object sender, CancelEventArgs e)
        {
            //By default, new windows launched by clicking a link from within the webbrowser control, open in Internet Explorer, even if the system default is another web browser such as Mozilla.
            //We had a problem with cookies not being carried over from our webbrowser control into Internet Explorer when a link is clicked.
            //To preserve cookies, we intercept the new window creation, cancel it, then launch the destination URL in a new window within OD.
            string destinationUrl = browser.StatusText;          //This is the URL of the page that is supposed to open in a new window. For example, the "ScureScripts Drug History" link.

            if (Regex.IsMatch(destinationUrl, "^.*javascript\\:.*$", RegexOptions.IgnoreCase))
            {
                return;
            }
            e.Cancel = true;                                        //Cancel Internet Explorer from launching.
            FormErx browserWindowNew = new FormErx(destinationUrl); //Open the page in a new window, but stay inside of OD.

            browserWindowNew.WindowState = FormWindowState.Normal;
            browserWindowNew.ShowDialog();
        }