/    Sign up×
Community /Pin to ProfileBookmark

window.open() and .doc files

Hi. I’m working on a project in javascript that launches pdf and doc files in a new browser window via hyperlinks. My problem is with verifying that the file exists. The files are on a CD, but I need to autodetect to see if the file opens properly in the new window. I’ve been using:

popup = window.open(url)
if(popup.location.href.indexOf(“error”) < 0)
popup.close();
alert(“…”);
}

which works great with the pdfs, but throws errors when the target url is a .doc file. Is there a way that I can tell if a .doc file has opened properly similar to how I’ve been verifying the pdfs?

Any help would be great.

thanks!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@SamFeb 07.2004 — I think that due to the fact that .doc doesn't count as a web extension, you can't open files to it. Windows wants to download it first... i'm not entirely sure though
Copy linkTweet thisAlerts:
@jevussauthorFeb 07.2004 — That makes sense. Is there a way to open a .doc and verify that it opens correctly in the same sense that I was able to with the pdf files?
×

Success!

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

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
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,
)...