It's a java desktop, need to capture url of current active browser window. Can I do this with java?
Asked
Active
Viewed 1,700 times
-1
-
2What is the use-case for this functionality? – Andrew Thompson Mar 26 '12 at 08:45
-
Take a look at the url class: http://docs.oracle.com/javase/7/docs/api/java/net/URL.html It allows you to fetch contents from a webpage – John Snow Mar 26 '12 at 08:57
-
Why vote down :(? I need for a time tracker application, Need to track what my coder doing in their work time. – complez Mar 26 '12 at 10:03
1 Answers
2
It is possible to get URL's of all Internet Explorer instances . But through C# approach , i could'nt find a solution using JAVA.
The alternative is to write C# executable which prints the URL , invoke it through java process and get the output.
String cmd = "/GetURL.exe ";
Process p = Runtime.getRuntime().exec(cmd);
You can use the stream readers to determine the output of the command executed .
Explained the C# approach to get the URL of IE objects using SHDOCVW.dll ,
How to get the URL of the Internet explorer tabs with PID of each tab?
just use C# Express edition 2008 and try the code , it will result in Interop.SHDocVw.dll and an Exe .
Since firefox is a third party application , i dont know if there is any way . Internet Explorer comes handy with the OS so it was possible .