/    Sign up×
Community /Pin to ProfileBookmark

How to open excel file from browser using javascript

Is there anyway to open Excel file from html page. So it will open separetly from internet explorer. One way to open it, is:
<a href=”data/CurrentAcerSheet.xls” target=”_blank” > open</a>.

But it does not work in other browsers except EI.
MS website recomends something like: go to menu, and then turn off this or may be that, I think that it will be very unconvinient for users.

So turning back again under protection of javascript, is there any way that you can open excel file using javascript?

Thank you very much.

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@ggallenJun 13.2006 — What if you open a var newwindow=window.open("url of .xls","window2","")?

Haven't tested it...so I don't know if it works.
Copy linkTweet thisAlerts:
@ggallenJun 13.2006 — What if you [CODE]var newwindow=window.open("url of .xls","window2","");[/CODE]

Haven't tested it...so I don't know if it works.
Copy linkTweet thisAlerts:
@ggallenJun 13.2006 — I just tested this, and it worked great.

George
Copy linkTweet thisAlerts:
@jtyceAug 20.2008 — How are you getting around the access denied issues using this code?
Copy linkTweet thisAlerts:
@JMRKERAug 20.2008 — Make sure that the permissions for 'directory' (755) and 'file (644)' access are set to at least 'read' for all users for the .xls you wish to download.
Copy linkTweet thisAlerts:
@jtyceAug 20.2008 — How do I do that? I am using The Excel COM object to generate the file from a dataset. I am replacing a Winforms application were I was using Process.Start to launch Excel with the file open. Now I am trying to find some way to deal with this export to Excel in ASP.NET. How do I programticly set these permissions for the worksheet object prior to or during the save.
Copy linkTweet thisAlerts:
@bbvSep 08.2009 — Hi,

I like to do the same thing which to open an excel file in html page and I found that you said this command "var newwindow=window.open("url of .xls","window2","");will work. But i don't know any javascript and the following is how my html page started with:

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Adobe GoLive">
<title>Title</title>
<csscriptdict>
<script type="text/javascript"><!--


function newImage(arg) {

if (document.images) {

rslt = new Image();

rslt.src = arg;

return rslt;

}

}

function changeImagesArray(array) {

if (preloadFlag == true) {

var d = document; var img;

for (var i=0; i<array.length; i+=2) {

img = null; var n = array[i];

if (d.images) {img = d.images[n];}

if (!img && d.getElementById) {img = d.getElementById(n);}

if (img) {img.src = array[i+1];}

}

}

}

function changeImages() {

changeImagesArray(changeImages.arguments);

}



// --></script>

</csscriptdict>

<csactiondict>

<script type="text/javascript"><!--



var preloadFlag = false;

function preloadImages() {

if (document.images) {

pre_menumainserviceson = newImage('images/menumainserviceson.jpg');

pre_menumaincompanyon = newImage('images/menumaincompanyon.jpg');

pre_menumaincontacton = newImage('images/menumaincontacton.jpg');

pre_prodsubNEWPRODUCTSON = newImage('images/prodsubNEWPRODUCTSON.jpg');

pre_prodsubPARTNERSON = newImage('images/prodsubPARTNERSON.jpg');

pre_prodsubWELDGUNSON = newImage('images/prodsubWELDGUNSON.jpg');

pre_prodsubWELDSTATIONSON = newImage('images/prodsubWELDSTATIONSON.jpg');

pre_prodsubCYLINDERSON = newImage('images/prodsubCYLINDERSON.jpg');

pre_prodsubAUTOMATIONON = newImage('images/prodsubAUTOMATIONON.jpg');

preloadFlag = true;

}

}



// --></script>

</csactiondict>

</head>



I wonder if you can help to show me how to tide that script into the page in order to get my excel file open in html page?



Thank you for your assistance.



B.
×

Success!

Help @Gerom7 spread the word by sharing this article on Twitter...

Tweet This
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...