I am trying to open a word document using window.open as below
window.open("myworddoc.doc");
It works fine in FF, but IE tries to open a tab, but closes it immediately and jumps back to the current screen (no dialog is displayed to save or open a file).
What could be the issue?
This is surely a security mesure. Opening Word documents using JavaScript could have nasty effects. Imagine if you are browsing the internet, and someone makes an infected Word document open when your page loads.
Personally, I’d create a PHP file, let’s say “servedoc.php”, and open that file like so:
servedoc.php could contain something like this:
IE will open the PHP file, as it’s a perfectly valid web file. And the PHP script would serve the file to the browser, asking the user to download the file.