IE trying to download content rather than load in window

I thought this would be an easy script but I’m having problems with IE7 (surprise surprise…).
I’m working with some YouTube videos, and what I’m basically doing is grabbing their embed code from their YouTube page and using just the URL to make the video pop up in a new window. Here is my function I wrote to open the new window:

function winPopYT(srcurl){
     	var url=""+srcurl;
     	if (window.focus) {

The base URL is included there and then the part that is different is called from an onClick in the HTML

<img src="../newdesign/images/l_vid_liver.jpg" style="cursor: pointer;" onClick="winPopYT('lwFoXxWkT9Y')" />

In Firefox, Safari and Chrome it works just fine and opens the video in the popup window, but on Internet Explorer it thinks that last part of the URL is a file and tries to download it. I’ve never seen this before, is this a common problem in IE? Does anyone have any idea how to fix it so it will just display the video?

Maybe with a trailing slash?


either in the inline or appended in the function.

var url=""+srcurl+"/";

Hmmm, that sounded like a good idea but it didn’t work. I just get “Page not found”

There may not be much you can do about it if I’m right about my guess.

If the file is sending some sort of “Content-Type” headers, it may be that your “working” browsers have been configured to open that file type in a media player, but IE isn’t configured to open it so it asks to download it.

If this is the case, then this technique will only work for those that have their browser options set right. I imagine most do, but it’s not reliable. Maybe you could figure out some kind of “fall back”?

If you make a direct HTTP request in your IE address bar to the same URL, does it open or ask to download?

Yeah, you’re probably right. I’ll probably need to figure out another way to accomplish this. The funny thing is that if I do make a direct HTTP request in the address bar in IE the video comes up just fine (but in full screen), so it must be something with Javascript that’s setting it off. If anyone has any other ideas why this might be happening I welcome their comments, in the meantime I’ll look into alternate ways of doing what I need done.

Did you try another url just to test?

Yeah, I tried several YouTube links and they all did the same thing.
I guess I’m going to have to file this as another stupid IE quirk and find another way to accomplish what I want to do.

Yeah, I tried several YouTube links and they all did the same thing.

YouTube is HTML5 and has a pile of JS doing lord-knows-what, I meant, does it work with Then another with a query string?