2

I am making an html/javascript browser homepage, that could be downloaded to any computer - you simply run the *.html file from your computer and it opens in your default browser; in it you have a compact homepage, with several options - you can make a bookmark list, write notes etc. You can leave it opened as it is just a separate tab.

I'm wondering whether it's possible to use javascript in order to open, for example, windows media player or make it possible for the user to set a default music player. Or even close the previously opened program? Could this be done?

I think it would be best if the user could just set the default programs. Getting the file location is not the problem, is anything else needed?

4 Answers 4

4

You can't do this unless you write a browser extension (plugin), for example.

Most web browsers put a lot of work into sandboxing JavaScript so any malicious users can't compromise the system the client's browser is running on, although older browsers are as watertight as sieves. Modern browsers are a lot better, but there are/may be some holes somewhere. All this security means that JavaScript can't (isn't supposed to be able to) access any part of the client's machine.

Sign up to request clarification or add additional context in comments.

4 Comments

By 'browser extension' you mean 'browser plugin'? Thanks for the answer.
I'm not sure it is impossible in every browser like you seem to imply. Old version of IE don't have any kind of sandboxing, and even in newer browser you can maybe configure something to let javascript access the local processes. But it's still a really bad idea to do it.
Yeah, it seems like a lot of effort for nothing. Thanks anyway.
@user1020567 Yes, they're one and the same.
1

Any respectable browser will block javascript from accessing anything on the user computer. It is a huge security risk to let a script in a HTML page do something like you want.

Depending on the browser and the configuration, it may be possible, but you absolutely shouldn't try to do it.

You can maybe achieve what you want through a browser extension, but you will have to write it for each different browser your customer are using.

Maybe the best thing to do is write a rich client instead of using HTML/Javascript.

2 Comments

Well, the custom homepage wouldn't be used online (from a certain webpage), but from the client's computer - it's just a local file which you can place anywhere you want on your computer. Why is it such a security risk when it's offline?
@user1020567 Because a web browser's primary function is to be used on line.
0

It would be doable if the HTML page were not opened in the browser! The browser makes its best not to allow such things for security purposes.

Not that JavaScript in itself is not able to do this -- the language is used in plenty of other places, see here.

Comments

0

You can do something similar to this using a wrapper like Fluid ( http://fluidapp.com/ ) which encapsulats your page and turns it into a native app (with its own sandbox) There are equivalent programs for other platforms as well as Mac.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.