14 Replies - 12432 Views - Last Post: 22 July 2010 - 04:07 PM Rate Topic: -----

#1 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

How do I prevent the web browser from opening a new tab in Internet Ex

Posted 21 July 2010 - 11:45 AM

I am making a downloader that downloads multiple scripts, 3d models, and programs. The only problem is that the web browser will open a new tab using Internet Explorer. How do I make it so that it will open in the web browser?
Is This A Good Question/Topic? 0
  • +

Replies To: How do I prevent the web browser from opening a new tab in Internet Ex

#2 Bent al-Yemen  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 106
  • Joined: 30-December 09

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 21 July 2010 - 12:06 PM

if i got your point , this not about your code, it's about your browser setting. From browser's bar choose tools-->general--->from tabs panel choose setting---->open links from other program (choose a new widow)--->ok


i hope that's what you mean.

This post has been edited by Bent al-Yemen: 21 July 2010 - 12:07 PM

Was This Post Helpful? 0
  • +
  • -

#3 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 21 July 2010 - 12:15 PM

This is the web browser I am talking about:
Posted Image
Was This Post Helpful? 0
  • +
  • -

#4 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 21 July 2010 - 12:22 PM

I don't understand your question. Are you using the WebBrowser control on your Windows Form and each time you try to download something a new tab opens in that control?

Please be more specific and clear.
Was This Post Helpful? 0
  • +
  • -

#5 Curtis Rutland  Icon User is online

  • (╯°□°)╯︵ (~ .o.)~
  • member icon


Reputation: 4490
  • View blog
  • Posts: 7,822
  • Joined: 08-June 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 21 July 2010 - 12:28 PM

I know what he means, although I don't know if there's any way to fix that. That WebBrowser control is just a wrapper for Internet Explorer. It's a tiny IE in your program. It's going to honor the user's settings, and if they want new links opened in new windows, it's going to do it for them. I don't think you can prevent that.
Was This Post Helpful? 0
  • +
  • -

#6 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 21 July 2010 - 04:42 PM

Hmm... Would it be too hard to REBUILD a whole browser? Like, download the html file, then view it?
Was This Post Helpful? 0
  • +
  • -

#7 Curtis Rutland  Icon User is online

  • (╯°□°)╯︵ (~ .o.)~
  • member icon


Reputation: 4490
  • View blog
  • Posts: 7,822
  • Joined: 08-June 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 21 July 2010 - 05:22 PM

It certainly wouldn't be easy. Are you hosting the page? You could make a web service instead, that you could get a list of URLs from, and bind that to windows controls to do the downloads.
Was This Post Helpful? 0
  • +
  • -

#8 Ändrew  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 25
  • View blog
  • Posts: 312
  • Joined: 21-April 08

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 22 July 2010 - 04:37 AM

Errr... Im sure there is a event handler called NewWindow in the browser control.

Just make it open a new tab in your web browser and make it handled

This post has been edited by Ändrew: 22 July 2010 - 04:38 AM

Was This Post Helpful? 0
  • +
  • -

#9 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 22 July 2010 - 02:28 PM

View PostÄndrew, on 22 July 2010 - 03:37 AM, said:

Errr... Im sure there is a event handler called NewWindow in the browser control.

Just make it open a new tab in your web browser and make it handled


noo idea what you are talking about... Can you explain?
Was This Post Helpful? 0
  • +
  • -

#10 Curtis Rutland  Icon User is online

  • (╯°□°)╯︵ (~ .o.)~
  • member icon


Reputation: 4490
  • View blog
  • Posts: 7,822
  • Joined: 08-June 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 22 July 2010 - 02:30 PM

http://msdn.microsof....newwindow.aspx

Add a handler to the NewWindow event and see if it works.

From what the MSDN says, it happens when users right-click and pick "open in new window" but it doesn't say anything about links with a target="_blank", so I'm not sure if this will work or not. Only way to find out is experimenting.
Was This Post Helpful? 0
  • +
  • -

#11 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 22 July 2010 - 03:18 PM

View PostinsertAlias, on 22 July 2010 - 01:30 PM, said:

http://msdn.microsof....newwindow.aspx

Add a handler to the NewWindow event and see if it works.

From what the MSDN says, it happens when users right-click and pick "open in new window" but it doesn't say anything about links with a target="_blank", so I'm not sure if this will work or not. Only way to find out is experimenting.



I got it to stop opening IE, but now it doesn't open the link. Any way to have that _blank open in the same window?
Was This Post Helpful? 0
  • +
  • -

#12 Curtis Rutland  Icon User is online

  • (╯°□°)╯︵ (~ .o.)~
  • member icon


Reputation: 4490
  • View blog
  • Posts: 7,822
  • Joined: 08-June 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 22 July 2010 - 03:29 PM

How did you get it to stop opening? Show the code, maybe we can figure it out.
Was This Post Helpful? 0
  • +
  • -

#13 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 22 July 2010 - 03:34 PM

View PostinsertAlias, on 22 July 2010 - 02:29 PM, said:

How did you get it to stop opening? Show the code, maybe we can figure it out.



 private void otherWeb_NewWindow(object sender, CancelEventArgs e)
        {
            e.Cancel = true;
        }

Was This Post Helpful? 0
  • +
  • -

#14 Curtis Rutland  Icon User is online

  • (╯°□°)╯︵ (~ .o.)~
  • member icon


Reputation: 4490
  • View blog
  • Posts: 7,822
  • Joined: 08-June 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 22 July 2010 - 03:46 PM

I'm not sure of the order of the events being fired here. If Navigating fires first, you could copy it's e.Url property to a variable. Then, when the NewWindow event fires, you could check to see if it's a new window, cancel, and tell it to navigave directly to the url.

If it's the other way, you might be able to store if it's cancelling or not in a bool, then check in the Navigating event. If it is, cancel and then .Navigate directly to the URL. Otherwise, allow it to proceed.
Was This Post Helpful? 1
  • +
  • -

#15 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: How do I prevent the web browser from opening a new tab in Internet Ex

Posted 22 July 2010 - 04:07 PM

View PostinsertAlias, on 22 July 2010 - 02:46 PM, said:

I'm not sure of the order of the events being fired here. If Navigating fires first, you could copy it's e.Url property to a variable. Then, when the NewWindow event fires, you could check to see if it's a new window, cancel, and tell it to navigave directly to the url.

If it's the other way, you might be able to store if it's cancelling or not in a bool, then check in the Navigating event. If it is, cancel and then .Navigate directly to the URL. Otherwise, allow it to proceed.



This is acting weird now. I now have this:

private void otherWeb_NewWindow(object sender, CancelEventArgs e)
        {
            e.Cancel = true;
            otherWeb.Navigate(otherURL);
        }

private void otherWeb_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            otherURL = e.Url.ToString();
        }


for some reason it opens a blank page.

here is the website it is viewing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1