How to open the ViewSource of an URL directly in Java?

87 Views Asked by At

I programmed a simple button that allows the user to open a desired website.

Desktop.getDesktop().browse(new URL(_urlString).toURI());

I want another button that allows the user to open the websites sourcecode directly. I tried the following:

Desktop.getDesktop().browse(new URL("view-source:" + _urlString).toURI());

But I received an "java.net.MalformedURLException: unknown protocol: view-source" exception (I suppose because it doesn't start with http or https). Does anyone know, how to do this in Java?

0

There are 0 best solutions below