Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3319082
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:46:57+00:00 2026-05-17T22:46:57+00:00

I have a web page with an applet as the only element that looks

  • 0

I have a web page with an applet as the only element that looks something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title>...</title>
</head>
<body>
<applet style="padding:1px; border:1px solid gray" mayscript="mayscript" codebase="..." name="AppletName" code="..." archive="..." width="600" height="500" alt="Alt Text">
  <param name="initial_focus" value="true"/> 
   Alt Text
</applet>
</body>
</html>

When the page initially loads, focus is set in the applet and I can tab through and interact with the applet just fine. However, if I leave the browser window and then come back to it, I can no longer regain focus on the applet just using the tab key.

Pressing F5 to reload the page fixes the page so that the Applet regains focus, but this solution is unacceptable.

How do I solve this problem? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:46:58+00:00Added an answer on May 17, 2026 at 10:46 pm

    Tentative solution:

    //Dean Edwards/Matthias Miller/John Resig
    function init() {
      // quit if this function has already been called
      if (arguments.callee.done) return;
    
      // flag this function so we don't do the same thing twice
      arguments.callee.done = true;
    
      // kill the timer
      if (_timer) clearInterval(_timer);
    
      window.onfocus = function() {
        if(!document.AppletName.isActive())
          document.AppletName.requestFocus();
      };
    }
    
    /* for Mozilla/Opera9 */
    if (document.addEventListener) {
      document.addEventListener("DOMContentLoaded", init, false);
    }
    
    /* for Internet Explorer */
    /*@cc_on @*/
    /*@if (@_win32)
      document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
      var script = document.getElementById("__ie_onload");
      script.onreadystatechange = function() {
        if (this.readyState == "complete") {
          init(); // call the onload handler
        }
      };
    /*@end @*/
    
    /* for Safari */
    if (/WebKit/i.test(navigator.userAgent)) { // sniff
      var _timer = setInterval(function() {
        if (/loaded|complete/.test(document.readyState)) {
          init(); // call the onload handler
        }
      }, 10);
    }
    
    /* for other browsers */
    window.onload = init;
    

    Note that the key part for detecting whether the applet needs focus and requesting it if so is (this only works if mayscript is enabled):

    if(!document.AppletName.isActive())
      document.AppletName.requestFocus();
    

    The rest of the code is just attaching the window on focus handling after the page is loaded (using the script JQuery.ready is based off of).

    Better solutions welcome.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple applet on a web page like this. (This is a
I have a web page with an applet that opens a popup window and
We have a web page (HTML javascript and PHP mostly) that allows a user
I have a web page that includes a bunch of images. Sometimes the image
I have a web page with DIV s with a mouseover handler that is
I have a web page that displays a long line graph inside a div
I have a web page that is being displaying in a winform app using
I just talked to my host that I have my web page at and
I have a web page that uses the QuickTime plugin to display a 360-degree
I have a web page that receives currently playing songs on my local radio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.