/    Sign up×
Community /Pin to ProfileBookmark

Help!how can I solve location.href problem?

Dear gurus and members,
I am a newbie in programming and javascript. I created a javascript function that will ‘launch’ an application located on user’s computer. The path of the application is fixed. Therefore, I use location.href to call the exe file. However, if the user’s computer does not have the application installed, an empty page will be displayed. How can I replace the empty page with a pop up message that requests user download and install the program? The code below is the function that is called from a Flash button on my website

[CODE]
function loadRecorder() {
//load application on user’s computer
location.href = “file:///C:/Program Files/IEBAudioRecorder/AudioRecorder.exe”;
}
[/CODE]

How can I add a code that displays a pop up message and link to download the installer if the function above fails to find the AudioRecorder.exe?

Looking forward to some replies soon

Thanks in advance,
Janice

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@javaNoobieAug 26.2004 — well i dont think you can mess with the client's file system if the page where the javascript function is located is on server side.. feel free to comment
Copy linkTweet thisAlerts:
@janice_2k4authorAug 26.2004 — Hi javaNoobie,

Basically, the script i posted earlier on works. It can call the exe/application located on the user's computer. However, if there is no such application on user's computer, it will display an empty page. Now, what I hope to solve, is to display the url to download the installer from the server when the location.href can't find the exact path.

Thanks in advance,

Janice
Copy linkTweet thisAlerts:
@javaNoobieAug 26.2004 — i'm guessing u might need server-side scripting to check for existence of a file
Copy linkTweet thisAlerts:
@AdamGundryAug 27.2004 — You can't do this reliably in browser-based JavaScript. The code you posted should (on most computers) give the user the option of saving or running the executable, if it exists, and show an error if it doesn't. Anything that lets you run executables without user confirmation or detect the existence of files on the system is a serious security flaw.

Adam
×

Success!

Help @janice_2k4 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...