Opening a window and getting its URL? - java

Are java applets capable of opening new browser windows and retrieving their end URL?

Are java applets capable of opening new browser windows and retrieving their end URL?
No, and it is really none of the applet's business. It is a security thing.
Imagine you control an applet that opens an innocuous window. I get bored with that and reuse the window to surf over to BigBustyBabes.com instead. That final URL is not something I (as a user) would want your applet to know.

This link might help with opening a new URL, but from the same browser window. However assuming that you can reach the path where a browser is, you could easily run it. However I think this can be done easier with javascript, at least the part with retrieving the end URL, javascript seems to be the solution.
For opening a new window with javascript: window.open(URL,name,specs,replace).
For retrieving a URL with javascript use document.URL

Related

A program that ask you which web browser you want to use

I want to make a simple program that ask you which browser you want to use.
When you'll click on a link (email or pdf for example), a program will appear instead of the browser and will ask you which browser you want to use.
First : in which code it's the best to write this?
Secondly : How to open the program and not the browser?
I need a bit of help to write this, because i don't know how begin
This is tricky. There is no uniform event for "User clicks on url" that spans all applications.
The most straightforward solution would be to create your application and register it as the default browser.
Personally I would be annoyed by having to select a browser each time I click a link so I would probably make a helper application that when it starts remembers the current default browser and then registers the browser selector as the default. And when the helper closes it would restore the default browser.
My Java is quite rusty but I think this should be possible in either language. Maybe a little trickier in Java due to the lack of a dedicated executable for your application.
For C#:
This will open the url in the default browser:
string url = "http://google.com/";
System.Diagnostics.Process.Start(url);
This will open the url in the specified browser:
System.Diagnostics.Process.Start(#"C:\Program Files\Mozilla Firefox\firefox.exe", url);
There will be an error if the browser does not exist.

How to wait for a java applet to load when automating Internet Explorer?

I am using mshtml and internet explorer to automate a website. The website is not publicly available. On a page there is a Java Applet which is contained in a APPLET html tag.
The problem is that sometimes the applet takes a long time to load and without it being loaded other controls on the webpage cause errors. I do not need to automate the applet and the applet has nothing to do with what I want to do other than it causes other problems.
Whilst there might be other things you would like to suggest, I would at this stage like to focus on my main question of trying to find some property or event in the HTML which indicates that the Applet is loaded.
Things I have tried to check;
The HTML document has an Applets property which returns the applet collection. This collection contains the applet.
The Applet has a readystate of 4, its object attribute is also not nothing.
Despite these checks the applet is still not loaded.
Anyone coming here, I am sorry but the answer to this question is that I could not find anything in the DOM (the html page) which indicated if the applet had loaded. I, however, believe that it will really depend on the page you are looking at. I think that due to security issues you cannot access the isActive function of the Applet itself. The best you can hope for is that there might be some other html or javascript on the page which also waits for the applet and then you can wait for this.

Opening a Specific Web Browser With a specific URL JAVA

I've been using the Desktop -> browse() method so far to open the default browser with a URL i now want to move opening 3 different browsers: IE, Chrome, Firefox what would be the best solution to do this?
I was thinking just Inputting into the Cmd line
start (browser.exe) (URL) as that would work
Or is there a better solution?
Many thanks for any advice

When i load a applet in page and then go in offline mode and restart browser, i get noclassfound exception, for applet

When i load a applet in page and then go in offline mode(by disabling network connection) and restart browser, i get noclassfound exception, for applet.
The question is quite unclear but still...
Perhaps it means that applet class, as a resource, was not cashed. But to be more sure I need to look at its html start web page and js (if it uses it)
Thank your guys for the answer but i got the solution, it is registered as a bug in the java and still not solved

Does this applet work for you?

I have found a solution to get the full file path of a file that is about to be uploaded using a Java Applet. I need this for an internal system not anything else "dodgy"!
Can anyone confirm if this works in an IE6 browser: http://www.maschek.hu/preview/ffx3_file/filepath.html
I have an IETester application that has IE6/7/8 in one place and all IE6 does is just load/wait for the page and it has been 10 minutes. I am trying to determine if this applet will work in IE6?
Its using PARAM tags so is that a no? This has worked on my IE8.
To get this to work, do I need to do more than change the PARAM tags to Object tags?
Thanks all
Check out this website -->
http://www.spoon.net/browsers/
Its a browser Sandbox. You can run any browser from the web. Very useful stuff.
If you want to test your application in IE6 you could use the Internet Explorer Application Compatibility Virtual PC Images supplied free by Microsoft. This will probably be more reliable than asking other people to do it for you.

Categories