Search code examples
jspstruts-1

how to minimize a web browser from on an button click from a jsp page?


how to minimize a web browser from on an button click from a jsp page?

The jsp code snippet is as below.

<html:form action="CallAction.do?option=case1" method="post">
   <input type="submit" name="submit" value="DoAction"/>
</html:form>

The corresponing java sturts code snippet is as follows:

public class CallAction extends org.apache.struts.action.Action {

    private static final String SUCCESS = "success";

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
        String forward = "";
        String option = "";
        CallForm callForm = (CallForm) form;
        option = callForm.getOption();

        if (option.equals("case1")) {
            new doAction().init();
            forward = "welcome";
        }

        return mapping.findForward(forward);
    }    
}

I want to minimize the web browser window once the DoAction button is submitted


Solution

  • This can be done using purely client side code, e.g. javascript.

    Take a look on the following post for details: http://www.htmlgoodies.com/beyond/javascript/article.php/3471151/MinimizeMaximize-a-Browser-Window.htm

    Or google "minimize browser window using javascript".

    Since this question is not about java but about javascript I am fixing the tagging of this question.