• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Loss of control over browser opened by applet??

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi There

i have a problem that i have looked at high and low today and am really interested to find an answer. I have opened a browser window from a java extension class written for an applet.... i.e

AppletContext a = getAppletContext();
URL url = new URL(link);
a.showDocument(url,"URS");

This works fine and ofcourse there are other options for "_blank", "_self" etc, instead of naming it as i did above "URS"...

My issue is that if noone closes this window and it falls behind the application, then the next time the method is run and the url changes, the web browser updates but is not brought to the front.... this old application is built with AWT, i do not see a way to regain control of this browser and bring it to the front. "_blank" will pop up a new browser window BUT eventually if the user does not close the windows they will have a pile of windows open.... Why would they have an option to name it if i can't access it again?? I could really use a hand, or an explanation of why this works this way if i am trying to do something that is in left field!!!

Thanks guys

Chris
[ August 20, 2008: Message edited by: chris belyea ]
 
chris belyea
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, it looks like IE defaults the window to the front when you use

showDocument(url, "Name");

but Mozilla does not... either way my application does'nt do it. I somehow have to open a new (temporary) browser from a java class with a dynamic URL that the java class recieves and have this new window close onBlur>... but the trick is i do not control the code on the webpage we are going to....

I never seem to get responses on this board but i am really hoping someone can shed some light... I am using an applet to spawn the browser but maybe the solution to this has nothing to do with applets, perhaps i am posting this in the wrong place??
 
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is not clear, at least to me, what you are trying to accomplish.

If you open another window that displays a web page you have no control over, no matter how it is done, why would you think you should have any control over it, and why would you want to?

When you are talking about 'bringing it to the front' do you mean the new browser or tab? That is controlled by the browser and the user of the browser can change these settings on a whim, and in no case should a program that the browser runs(i.e. your applet) be able to 'control the browser'.

If you want that 3rd party page to close onBlur, you would need to download the file to your applet(in other words make a HTTP connection) and add in the javascript to do that in the downloaded file, save it, and then tell the browser to open up your modified page. There are programs that do this sort of thing like Greasemonkey(an add on for Firefox), but I don't think you can do this in the same manner as an applet. I believe as an add-on greasemonkey has a lot more privileges than an applet.

There are several issues when doing something this. The first is that unless the Applet is signed(or change the settings in the security manager, something you CAN'T do on others machines-please don't ever ask others to lower security settings just so they can run your program), you won't be able to open a socket to a third party server, nor can you save a file to the local machine. The second is that people might frown on adding javascript to web pages they view. I don't know if there are copyright issues, but from a security standpoint this is suspect.
[ August 21, 2008: Message edited by: Rusty Shackleford ]
 
chris belyea
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey rusty thanks for the reply.... My application is internal only... at the end of accomplishing a task, the applet opens a browser and goes to an internal url....

The users are lazy and want what they want, they don't want to follow our standard proceedures, so they don't bother closing the web page and then expect the next time the application accomplishes the same task, then that existing browser instance will again be brought to the forefront displaying the new information, but it does'nt, it just changes behind the scenes and they don't like that. I have argued blue in the face that we are not following standard practices BUT they don't care, nothing about the program is normal anyway so i needed to come up with some type of workaround but i can't seem to come up with anything.

The url we hit is dynamically assembled and passed to the applet.. i don't have access to the code from the web page we actually hit soooooo i was trying to control the browser, either bring it to front, or close it onBlur so that when it called showDocument the next time it would create a new browser instance and when that happens it always opens a new one on top... My problem basically lies in the fact that the user won't close the browser window on their own, and i have been told to fix it... :-(
 
Evacuate the building! Here, take this tiny ad with you:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic