PDA

View Full Version : Opening new window in browser.


nicholaspaul
04-18-2006, 03:42 AM
I have a script that opens a new windows, but I'm having trouble with it opening in Firefox, so I want to force it to open in Internet Explorer. Incidentally, this is for an interactive CD that has two sides, Mac and Windows, but it's the Windows version I'm having trouble with.

In my research I have decided that most (if not all) users will have IE still installed so forcing a page to open in IE (whether it is the default browser or not) shouldn't be an issue.

The code I have at the moment is as follows:<script language="javascript" type="text/javascript">
<!--
var browserName=navigator.appName;
if (browserName=="Microsoft Internet Explorer")
{

window.open("data/ie/index.html","nbd","left=100, top=100,width=850,height=650,resizable,scrollbars=yes,status=0");

}
else
{
window.open("data/mozilla/index.html","nbd","left=100, top=100,width=850,height=650,resizable,scrollbars=yes,status=0");

}
//-->
</SCRIPT>
Bascially, it is detecting the browser and opening the corresponding page on the CD. I have two different versions, each with different style sheets, incase you were wondering why there would be two different index.html pages, but for this post that is really irrelevant.

My main concern at this point is to find a way to force the new page to open in Internet Explorer only.

Kravvitz
04-18-2006, 04:26 AM
You can't do that. One browser can not open a page in another browser with JavaScript.

Are you not aware that there are ways of giving IE its own stylesheet?

I recommend using IE's conditional comments. Just remember that only IE5+/Win supports them.
About Conditional Comments (http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp)
Some more information on conditional comments can be found on this page. (http://www.positioniseverything.net/articles/multiIE.html)
QuirksMode.org : Conditional comments (http://www.quirksmode.org/css/condcom.html)
http://www.google.com/search?q=IE+conditional+comment

boxxer03
04-18-2006, 04:31 AM
I don't understand how it would not be opening a window in Firefox, I use window.open on my site and it works everytime.

nicholaspaul
04-18-2006, 04:31 AM
OH yes, of course. What was I thinking - that makes total sense!
Ok back to the drawing board - perhaps there's a way to get Actionscript to pick the browser, but that would be another post/another forum.

"Are you not aware that there are ways of giving IE its own stylesheet?"
No. I had no idea! Thanks for the tip - and thanks for the links, I'll do some reading!

nicholaspaul
04-18-2006, 04:35 AM
I don't understand how it would not be opening a window in Firefox, I use window.open on my site and it works everytime.
The problem is that the request to open the new page is coming from a CDROM. Firefox doesn't take kindly to that.

boxxer03
04-18-2006, 04:35 AM
Oh yeah, I didn't realize that, my bad. :)

nicholaspaul
04-18-2006, 04:39 AM
No problem, I might not have explained it very well.