Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / July 2006

Tip: Looking for answers? Try searching our database.

applet "interrupts" webpage navigation

Thread view: 
boku.ronin@gmail.com - 26 Jul 2006 10:23 GMT
hi all,

i've written a small applet that runs next to the browser and provides
kind of a notepad-functionality (logging the webpages the user is
visiting).
whenever the user changes webpage, the applet is (of course
)stopped/destroyed and then reinitialized. so far, so good; i've
written the applet as singleton so that it preserves its data between
the reloads.

my problem is that the applet seems to temporarily "steal" the focus
from the browser (when it is stopped and reinitialized), interrupting
the navigation to the new webpage; i.e., the user usually has to press
the navigation-buttons several times before the browser goes to the new
webpage.
An example: if I'm on a webpage and want to go back to the previous one
(and i'm thus pressing the back-button of the browser), i see that the
applet is re-initialized (appears that the browser has notified the JVM
of an imminent webpage change), but the browser then remains on the OLD
webpage (i.e., does not load the new webpage).

any idea how i could solve this problem ? (i've tried to insert a
Thread.sleep command in the stop/destroy function of the applet, hoping
it would pause the applet long enough to give the browser time to go to
the new webpage before the applet is reloaded, but it didnìt work...)

any help is really appreciated...
Thanks in advance,
Chris
Andrew Thompson - 26 Jul 2006 18:41 GMT
..
> i've written a small applet that runs next to the browser

What do you mean 'next to the browser'?  Applets can only
appear in web pages, the applet viewer, or aplications that
can provide an AppletContext.

Do you mean that your applet appears in a web-page
that pops-up 'beside' the main web page?

>..and provides
> kind of a notepad-functionality (logging the webpages the user is
> visiting).
> whenever the user changes webpage, the applet is (of course
> )stopped/destroyed

It might not be..

>.. and then reinitialized.
> ..so far, so good;

..no, the applet is already in trouble, even if you don't depend
on pop-ups.  While VM's are supposed to call the stop()/detroy()
methods, it is actually the browser that invokes that action.

Some browsers cannot be relied upon to invoke the
stop()/destroy() methods.

>..i've
> written the applet as singleton so that it preserves its data between
> the reloads.
>
> my problem is that the applet seems to temporarily "steal" the focus
> from the browser

Which one?  It is a phenomenon of applet focus that
browsers either give focus to applets, or they do not.
Neither action is incorrect, since Sun never bothered to
specify what *should* happen to the focus if a focusable
applet is in a web-page.

> any idea how i could solve this problem ?

Redesign your site to not require ..
- applets for navigation,
- pop-ups,
- the browser to call stop()/destroy() for applets
- applets where focus matters (or alternately
'pages that rely on JS to control the focus').

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.