I have the following code for opening a local web page with a parameter:
String url = "file:///C:/work/my_page.html?";
String params = "message=HelloWorld";
Desktop.getDesktop().browse(new URI(url + params));
But, when the browser is opened, the parameters string (?message=HelloWorld
) is removed.
While when I call some page with http://
prefix, it does work.
How can I make it work also with local file ? (i.e. such that starts with file:///
)
You cannot. http:// is one protocol which allows parameters. file:// is another protocol which does not allow parameters.
Suggestion is - create local web site (for example jetty) and use http potocol only. BTW, all other http stuff like AJAX will not work either.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With