AlexBB

WebBrowser wb = new WebBrowser ( );

wb.Navigate ( url, true ); // <===

wb.Show ( );

It does not give me a NEW Window in Vista but does in XP. Why It is a big headache.

Thanks.




Re: Windows Forms General WebBrowser Class

eradicator

AlexBB wrote:

It does not give me a NEW Window in Vista but does in XP. Why It is a big headache.

I imagine it is not a Vista versus XP issue, but rather a setting difference in Internet Explorer. On the Vista machine, open up Internet Explorer and get to the Internet Options configuration dialog (may be different ways to get there depending on the version). On my version, I use "Tools/Internet Options", then click the "Advanced" tab and look at the setting: "Reuse windows for launching shortcuts". Or it might be a different setting to change. Just trying to give you an idea of what to look for. But again, I doubt this is a Vista-versus-XP issue.






Re: Windows Forms General WebBrowser Class

AlexBB

I do not think it has anything to do with Internet Explorer or any settings thereof. For one thing that box you mention was checked in my Internet Options. Secondly I do not believer a WebBrowser instance is in the very least is affected by any settings over there. It would have been absurd for the developers to look for settings in such applications.

The second parameter in the wb.Navigate ( url, true); is an order to open a NEW Window. Otherwise it would have been false.






Re: Windows Forms General WebBrowser Class

CalvinR

Absurd I wouldn't be so quick to start throwing around that word.

If you were to look at the documentation in MSDN for the webbrowser control you can clearly see that it in fact does use the settings specified in Internet Options.

As far as I know the reason for this is that the WebBrowser control *is* Internet Explorer, the control just gives you a programmable API for it. In fact I'm sure this control is nothing but a wrapper for the old AXWebBrowser Control.


An example from the goHome method:

You can use this method to implement a Home button similar to the one in Internet Explorer. The user can specify a home page in the Internet Options dialog box, which is available from Control Panel or from the Tools menu in Internet Explorer.
http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.gohome.aspx





Re: Windows Forms General WebBrowser Class

H. Tony

AlexBB wrote:

I do not think it has anything to do with Internet Explorer or any settings thereof. For one thing that box you mention was checked in my Internet Options. Secondly I do not believer a WebBrowser instance is in the very least is affected by any settings over there. It would have been absurd for the developers to look for settings in such applications.

The second parameter in the wb.Navigate ( url, true); is an order to open a NEW Window. Otherwise it would have been false.



are you using IE 7 under vista and IE 6 under XP

that box is checked means that New explorer window will be opened as a new TAB in the existing IE windows instead of a NEW IE window.






Re: Windows Forms General WebBrowser Class

eradicator

AlexBB wrote:

I do not think it has anything to do with Internet Explorer or any settings thereof. For one thing that box you mention was checked in my Internet Options.

And is it set differently on the other machine I assume "my Internet Options" means on the Vista machine, so how does this compare to the setting on the XP machine, or vice-versa

Hey, I was just trying to give you something to go on. I could be wrong, but like CalvinR indicated afterwards, it does use Internet Explorer settings, and I had a sneaking suspicion that it did, when I initally responded.

If you don't like what I had to say and just want to immediately dismiss it as nonsense, fine. Good luck then.

Edit: Just testing to see if I can edit this message even though I know it has been replied to. If this new paragraph shows up, isn't that a problem with the forum






Re: Windows Forms General WebBrowser Class

AlexBB

eradicator wrote:
AlexBB wrote:

I do not think it has anything to do with Internet Explorer or any settings thereof. For one thing that box you mention was checked in my Internet Options.

And is it set differently on the other machine I assume "my Internet Options" means on the Vista machine, so how does this compare to the setting on the XP machine, or vice-versa

Hey, I was just trying to give you something to go on. I could be wrong, but like CalvinR indicated afterwards, it does use Internet Explorer settings, and I had a sneaking suspicion that it did, when I initally responded.

If you don't like what I had to say and just want to immediately dismiss it as nonsense, fine. Good luck then.

I am sorry. My apology. Don't take it that hard. I really appreciate any help.

The bottom like: I am still there. It does not work.

I still think this has nothing to do with the problem. For one thing I unchecked it a minute ago and the behavior has not changed. What do you think about it Shall I restart the machine for it to get enforced

The Navigate Command clearly says that the second parameter bool means new window when it is true. It does not obey.

I will check in XP as you said, I had it in mind. I have to shut this machine off and for to that partition. I cannot do it now. I will report later.

Look at this semantically: It says: "Reuse windows for launching shortcuts (when tabbed browsing is off)"

What does it mean I do not quite understand, honestly, but I don't think my situation has anything to do with any shortcuts.

Again, I appreciate your help.

Thanks.






Re: Windows Forms General WebBrowser Class

eradicator

Ok, no problem.

I really don't know the answer, I was (and still am) just trying to give you some ideas of what you could look for. Like I indicated in my initial post, it might be some other setting within Internet Explorer, not necessarily this particular setting, which controls whether new windows are created. I think you should compare all the settings between the XP machine and the Vista machine and experiment with changing them.

I know this doesn't give a definitive answer - again, I don't know for sure what the answer might be, just have some hunches on what could influence the behavior.






Re: Windows Forms General WebBrowser Class

AlexBB

eradicator wrote:

Ok, no problem.

I really don't know the answer, I was (and still am) just trying to give you some ideas of what you could look for. Like I indicated in my initial post, it might be some other setting within Internet Explorer, not necessarily this particular setting, which controls whether new windows are created. I think you should compare all the settings between the XP machine and the Vista machine and experiment with changing them.

I know this doesn't give a definitive answer - again, I don't know for sure what the answer might be, just have some hunches on what could influence the behavior.

Thank you for forgiving meSmile

I went to XP an hour ago. That checkbox is CHECKED over there. It is now UNCHECKED in Vista. It is still doing it. It paints a new window browser over any old one.

I cannot do this sort of comparison you are suggesting, sorry. It would be a major project. I can live with this inconvenience for a while. I think Vista may have another setting somewhere, not necessrily Internet Browser related which controls it but it is hard to uncover.

If you come across an answer, I am sure you will post the solution. Likewise I will do it as well. But that checkbox does not make sense logically to be related to it.

Many thanks.






Re: Windows Forms General WebBrowser Class

CalvinR

If youi read the remarks on the WebBrowser.Navigate method you'll see this little tidbit of info

You can handle the NewWindow event to receive notification before a new browser window is opened, allowing you to cancel the action if necessary.

So try handling the NewWindow Event to see if it is getting fired at all.





Re: Windows Forms General WebBrowser Class

AlexBB

CalvinR wrote:
If youi read the remarks on the WebBrowser.Navigate method you'll see this little tidbit of info

You can handle the NewWindow event to receive notification before a new browser window is opened, allowing you to cancel the action if necessary.

So try handling the NewWindow Event to see if it is getting fired at all.

I just read your motto. I love it. It is very, very true.

Anyhow, it was a sharp suggestion. I expected it to fire and it did. It does every time I press the button. It paints the "new window" over any old one as if they changed the definition of "new."






Re: Windows Forms General WebBrowser Class

eradicator

I wonder if you've tried a different overloaded method:

wb.Navigate(url, "_blank");

to tell it what the target frame should be. _blank (as you probably know) basically means to use a new window. Just something more to try.






Re: Windows Forms General WebBrowser Class

AlexBB

eradicator wrote:

I wonder if you've tried a different overloaded method:

wb.Navigate(url, "_blank");

to tell it what the target frame should be. _blank (as you probably know) basically means to use a new window. Just something more to try.

Thank you. I am surprised it compiled but the result is the same at runtime.

I changed the code a bit to no avail either.

wb.Url = new Uri ( url );

wb.Navigate ( new Uri ( url ), "_blank" );

wb.Show ( );

I am wondering if it may have something to do with the parent class: Form. Perhaps they changed something in there that is inherited. I wanted to look into it but have no time.

Alas.






Re: Windows Forms General WebBrowser Class

eradicator

AlexBB wrote:

Thank you. I am surprised it compiled but the result is the same at runtime.

It's just one of the overloaded methods, taking a Uri or string, and a string target frame name. There's really nothing which should surprise you.

AlexBB wrote:

wb.Url = new Uri ( url );

Wait - why are you doing the above Setting the Url property makes it navigate right there! Don't do that, just use the Navigate method.

Please refer to the API documentation:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.url.aspx






Re: Windows Forms General WebBrowser Class

AlexBB

eradicator wrote:
AlexBB wrote:

Thank you. I am surprised it compiled but the result is the same at runtime.

It's just one of the overloaded methods, taking a Uri or string, and a string target frame name. There's really nothing which should surprise you.

AlexBB wrote:

wb.Url = new Uri ( url );

Wait - why are you doing the above Setting the Url property makes it navigate right there! Don't do that, just use the Navigate method.

Please refer to the API documentation:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.webbrowser.url.aspx

The documentation is one thing but real life is differentSmile. I tried to keep the statement you are referring to and commenting out the next one, Navigate. It did not NAVIGATE anywhere beyond my computer.