Opening local HTML file

What I want to know is how to open an local HTML file in the game's files in the engine itself. However, when the HTML is opened it will open on the users default browser. Does anyone know if this is possible?

This is not an external link request, I understand Yanfly has a script for that. I specifically want to know how to open an external file in-game.
It's the same as any external browser opening plugin, just set the url to the local url.

For example, here's a function that does it for you.
Code:
function openLocal(file) {
  var path = require('path');
  var base = path.dirname(process.mainModule.filename);
  var url = path.join(base, file);
  var cmd;
  if (process.platform === 'darwin') cmd = 'open';
  if (process.platform === 'win32') cmd = 'explorer.exe';
  if (process.platform === 'linux') cmd = 'xdg-open';
  var spawn = require('child_process').spawn;
  spawn(cmd, [url]);
}

So if you do:
openLocal('test.html');
it'll open the test.html file thats in the root of your project (the folder with the index.html)

you can also do directories like:
openLocal('somedir/test.html');

If you just want to use an existing browser opening plugin, then again the only part you need would get to get the correct path, so you just need:

Code:
var path = require('path');
var base = path.dirname(process.mainModule.filename);
var url = path.join(base, FILEPATH_TO_OPEN);

Also all this only works when playing from desktop.
You might want a plain link fallback, if require === undefined, because then you should already be in the default app/browser.

Another way instead of forcing people to open your link in the browser, is just giving them the link to copy and a nudge to visit it. That way people won't feel like their security has been violated: pop-ups usually pertaining to adware or what not.

PHP:
prompt("Copy this link or something...","http://google.com/");
Screen%20Shot%202017-04-08%20at%2012.23.46%20AM.png
Also all this only works when playing from desktop.
When you say this, do you mean the game's folder needs to be on the desktop? If so, that might be an issue.

@mogwai Something to consider, but something I want to do more research into as well. I know how to code HTML, but I'm not sure what domains are available to host these files or how much I need to pay for a domain even for a trivial amount of webspace. I may be speaking nonsense if those are not huge problems, admittedly, since that's not the side of web programing I have education in.

Edit: So yanfly, today, just released a new plugin that allows players to access a local HTML file via the F1 key or the menu. Does anyone think it can be edited to allow multiple HTML files that can be opened individually through a script call? Because that's exactly what I need.
On a quick look, it seems like that is opening links in the game wrapper instead of a browser.

Another way, I just Googled and read about, is a shell script shortcut. https://superuser.com/questions/277186/symlink-to-a-url

I think this is similar to what Quxios posted. I've never used one before.
@mogwai How it opens does not matter, I only said browser because that's how I personally open HTML. I wasn't even aware MV could open up a separate window for another file.

Again, I'm not looking for a direct link for a URL. Just a way to open a local HTML document.
In that case, by event script.
PHP:
document.location.href = "myHTMLfile.html"; // in the game folder
or
PHP:
document.location.href = "path/myHTMLfile.html"; // in a folder inside the game folder
new window
PHP:
window.open("myHTMLfile.html");
@mogwai The new window script call is exactly what I'm looking for. Thanks for the help and thank you for bearing with me.
This request can be closed now.
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/opening-local-html-file.77937/