0

simply using window.open works for everything ive tested in IE, however when it comes to Google Chrome, the exact code just opens up a blank new tab.

ive tried these combinations:

  • Network Drives window.open("\\\\Server\\Data\\NewFolder\\Video.mp4");
  • Local Drives Network Drives window.open("C:\\NewFolder\\Video.mp4");
  • Chromes way of file viewing: window.open("file:///C://NewFolder//Video.mp4")

am I doing something wrong here or does Chrome have its own way of opening and displaying files?

what I want to happen is for Chrome to either play the .mp4 file itself or open it in Windows Media Player but neither happens.

cheers for any help

if I was to type in file:///C:/NewFolder/Video.mp4 then this would play the file in chrome. using window.open does absolutely nothing other than display about:blank. it will however open a web url but not a file on my computer or a server

Crezzer7
  • 2,265
  • 6
  • 32
  • 63
  • What happens if you manually browse to any of those locations in Chrome? Also, does anything show up in the browser console? – James Thorpe Dec 11 '14 at 13:07
  • Maybe this can help? http://stackoverflow.com/questions/2572333/google-chrome-window-open-workaround – SmartDev Dec 11 '14 at 13:15
  • can you show your full code ? – Alok Dec 11 '14 at 13:17
  • the 2 examples are the full code for opening a file in IE, the Chromes way is what is in the URL bar when I drag and drop a video to play. its only a short bit of code itself however chrome is making the extremely difficult – Crezzer7 Dec 11 '14 at 13:22

1 Answers1

0

The code below works just fine in Chrome (i.e. invoked directly from a click event -- obviously in the real world you bind dynamically, this is just for test purposes). Note that I've simplified the forward slashes: you don't need to double those up.

How are you triggering your call?

JS:

function openThing() {
  window.open("file:///c:/newfolder/video.mp4");
}

HTML:

<a href="#open" click="openThing(); return false;">Open Thing</a>
Ben
  • 7,548
  • 31
  • 45
  • trying to get it to work now, using Lightswitch in Visual Studio and they don't make it easy. I have a button that when clicked on triggers the code associated with that button – Crezzer7 Dec 11 '14 at 13:34