[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 743
  • Last Modified:

IE7 opens two browser windows instead of one

I have a VB App that I wish to use to open a browser window with certain defined characteristics - no menu, no toolbar etc. I can do this using automation, but when I try to navigate to the URL I find with IE 7 I am getting two windows open. The first just says "connecting..." while the second opens to the correct URL, but with all the default browser settings - menu, toolbar etc. From searching around I can see this is because the new URL is in a different security context - in this case it is on the Intranet - but I have been unable to find a workaround to the problem.

I believe you get the same problem with JavaScript if you open a new window and then set the URL, where the new URL is in a non-default security context, such as HTTPS or on the intranet.
0
purplesoup
Asked:
purplesoup
  • 4
  • 2
1 Solution
 
forrest321Commented:
Can you post the script you are using?
0
 
purplesoupAuthor Commented:
This is the JavaScript that has the same effect:

var winName = 'testwin';
var settings='width='+w+', height='+h+', top='+t+', left='+l+', scrollbars=yes, location=no, directories=no, status=yes, menubar=no, toolbar=no, resizable=yes';
var sURL='http://localhost/testsite/test_page.html';
var win1=window.open('',winName,settings);
if (win1==null) {
  alert ('unable to open a new window');
  return;
}

if (win1.history.length==0) {
  win1.location = sURL;
}

win1.focus();

There is nothing weird about this, it is simply opening a window and then setting the URL - if the URL is in a different security context you will get two windows open and the second will be in a default browser window.

The important point about the above JavaScript is that it has to be run in a web page opening via the file system, not from the local web site.

The same problem is reported at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1342849&SiteID=1  but there does not appear to be an answer given.

Note - as I say I am actually looking to do this from a Visual Basic application - it is just this problem also occurs via JavaScript.
0
 
EDDYKTCommented:
I don't have ie7 installed but just a thought.


can you disable to block the pop-up windows and try again?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
purplesoupAuthor Commented:
I think this might work with the JavaScript code - you could replace
var win1=window.open('',winName,settings);
with
var win1=window.open(sURL,winName,settings);

but in the Visual Basic code you *have* to create an instance of internet explorer before you call the navigate method and this results in a second browser opening, so it won't fix my real problem.
0
 
EDDYKTCommented:
0
 
purplesoupAuthor Commented:
I'm tempted to accept EDDYKT because I think I can use listing all open windows to work around this problem, however I would like to know if there is a way to really fix this problem. The basic problem appears to be that in Vista with IE 7 there is something called "protected mode" and if you initially create an internet explorer object - or do a window.open('') in JavaScript then protected mode is off, but if you then try to navigate the browser to a URL, or in JavaScript set the location property then typically you will navigate to a site where protected mode is on, and this will result in a second browser window opening.

Therefore is there a way to set the initial protected mode to "on", rather than off, so  it is possible to load the URL without opening a second browser?
0
 
purplesoupAuthor Commented:
OK - here is some more stuff.

It seems it is possible to use some new methods when using IE with automation to avoid these problems:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ietechcol/dnwebgen/protectedmode.asp

In particular it seems you should use IELaunchURL instead of Navigate().

http://msdn.microsoft.com/library/default.asp?url=/workshop/security/protmode/reference/functions/IELaunchURL.asp

However I would like to see a VB example on how to call this!

Second for the JavaScript code it seems you can use something called "mark of the web":  

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/motw.asp

This basically means putting something like this at the top of your page:
<!-- saved from url=(0014)about:internet -->

This will set your page to default to the internet zone and so any new page that launches from that page will also be in this zone (which will be in protected mode), however I now find that when I try to launch a new window I get an "access is denied" error.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now