Closing the Second instance of the browser.

Hello,
I am working on a project written in Java. When applet is running in Browser, we can open the new instance of the browser using File->window->new (or pressing CTR-N). Since the second window runns in the context of first window, It is causing some problem.
Is there any way for me to close the second instance of the browser from my Java applet?? If not is there any way for me to disable both the File->new->Window and CTR-N options.
I am new to java and java script. If it is not possible in Java Applet, is it possible in java Script. Please Provide me with full information.
Thanks and Regards,
Ratna.

Hi,
There is no way you can close the browser window that the user opens. Even if there is a way through some hack, it will not completely give u a solution, independant of browsers and all. And moreover it is not advisable to restrict the user like that.
A more elegant way would be to handle it in the server side. I can give u one ligical way. U can make the page expire as soon as it gets loaded. U can do that by using the code below. And you have to have a server side function to check for a request from the same client machine for the same page.
<%
    if (request.getProtocol().compareTo("HTTP/1.0") == 0)
        response.setHeader("Pragma", "no-cache");
    else if (request.getProtocol().compareTo("HTTP/1.1") == 0)
        response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Expires", "-1");
%>So when the user opens a new browser window, he will be shown page expired message, or the page will be requested again from the server. U can have a map storing the remote address and the session of the user.

Similar Messages

  • Why is the second row in the recordset not updated?

    Hi,
    I have this problem.
    I have written a servlet named processPOItem.
    The following is the doPost Method in the processPOItem class:
    public class processPOItem extends HttpServlet {
    //attributes
    public String strPO;
    ConnectionPool connectionPool = null;
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, java.io.IOException {
            int counter=0, remainder=0;
            String SearchPOItems;
            String strStatus, ISBN;
            String price;
            response.setContentType("text/html"); //html output
            PrintWriter out = response.getWriter();
            //get the parameter named PO
            strPO = request.getParameter("PO");
            Connection dbConn = null;
            try{  
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Purchase Order " + strPO + "</title>");
                out.println("</head>");
                out.println("<body>");
                out.println("<table width=600 border=0 align=center>");
                out.println("<tr>");
                out.println("<td colspan=4 align=center>");
                out.println("<font face=Arial size=2>");
                out.println("<b>Purchase Order: " + strPO + "</b>");
                out.println("</font>");
                out.println("</td>");
                out.println("</tr>");
                out.println("</table>");
                out.println("<form method=post action=processPOItem>");
                out.println("<input name=updatePO type=hidden value=1>");  
                out.println("<table width=800 border=0 cellspacing=1 cellpadding=0 align=center>");
                out.println("<tr bgcolor=\"#990000\">"); //Display the mb_PurchaseItem
                out.println("<td align=center><b><font size=1 face=Verdana color=\"#FFFFFF\">No</font></b></td>");
                out.println("<td align=center><b><font size=1 face=Verdana color=\"#FFFFFF\">ISBN</font></b></td>");
                out.println("<td align=center><b><font size=1 face=Verdana color=\"#FFFFFF\">Title</font></b></td>");
                out.println("<td align=center><b><font size=1 face=Verdana color=\"#FFFFFF\">Status</font></b></td>");
                out.println("<td align=center><b><font size=1 face=Verdana color=\"#FFFFFF\">Quantity</font></b></td>");
                out.println("<td align=center><b><font size=1 face=Verdana color=\"#FFFFFF\">Unit Price</font></b></td>");
                out.println("<td align=center><b><font size=1 face=Verdana color=\"#FFFFFF\">Delivered Date</font></b></td>");
                out.println("</tr>");
                //get the SQL statement
                SearchPOItems = searchSQL(strPO);
                //get free connection from Pool
                dbConn = connectionPool.getConnection();
                //create a statement object
                Statement stmt = dbConn.createStatement();
                //create the recordset
                ResultSet rs = stmt.executeQuery(SearchPOItems);
                //display the recordset
                while (rs.next())
                    counter++;
                    remainder = counter % 2;
                    if (remainder == 0)
                       out.println("<tr bgcolor=\"#C1C1C1\">");
                    else
                       out.println("<tr bgcolor=\"#E1E1FF\">");
                    //Display the individual Purchase item under the customer
                    out.println("<td align=center><font size=1 face=Verdana>" + counter + "</font></td>");
                    ISBN = rs.getString("mb_ISBN");
                    out.println("<td align=center><font size=1 face=Verdana>" + ISBN + "</font></td>");
                    out.println("<td align=center><font size=1 face=Verdana>" + rs.getString("mb_Title") + "</font></td>");
                    strStatus = rs.getString("mb_Status");
                    out.println("<td align=center><font size=1 face=Verdana>");
                    out.println("<select name=\"mb_Status" + ISBN + "\">");
                    out.println("<option value=PENDING");
                    if (strStatus.equals("PENDING"))
                       out.println("selected>Pending</option>");
                    else  
                       out.println(">Pending</option>");
                    out.println("<option value=PROCESSING");
                    if (strStatus.equals("PROCESSING"))
                       out.println("selected>Processing</option>");
                    else  
                       out.println(">Processing</option>");               
                    out.println("<option value=DELIVERED");
                    if (strStatus.equals("DELIVERED"))
                       out.println("selected>Delivered</option>");
                    else  
                       out.println(">Delivered</option>");
                    out.println("<option value=CANCELLED");
                    if (strStatus.equals("CANCELLED"))
                       out.println("selected>Cancelled</option>");
                    else  
                       out.println(">Cancelled</option>");
                    out.println("</select>");
                    out.println("</font>");      
                    out.println("</td>");
                    out.println("<td align=center><font size=1 face=Verdana>" + rs.getString("mb_Qty") + "</font></td>");
                    /*price = rs.getString("mb_Price");
                    NumberFormat moneyAmount = NumberFormat.getCurrencyInstance();
                    Double dPrice = Double.parseDouble(price);
                    out.println("<td align=center><font size=1 face=Verdana>" + rs.getString("mb_Price") + "</font></td>");
                    out.println("<td align=center colspan=2><font size=1 face=Verdana>");
                    if (strStatus.equals("DELIVERED"))
                        //status = "DELIVERED"
                        out.println("<input align=center name=\"deliveredDate" + ISBN + "\" type=text size=10 maxlength=10 value=" + rs.getString("mb_DeliveredDate") + ">");    
                    else
                        out.println("<input align=center name=\"deliveredDate" + ISBN + "\" type=text size=10 maxlength=10 value=Nil disabled>");
                    out.println("</font>");   
                    out.println("</td>");
                    out.println("</tr>");
                out.println("<tr><td> </td></tr>");
                out.println("<TR>");
                out.println("<TD colspan=3 align=center>");
                out.println("<INPUT TYPE=submit BORDER=1 value=update name=update>");
                out.println("</td>");
                out.println("<TD colspan=3 align=center>");
                out.println("<a href=\"javascript:window.close()\"><img src=\"Close.gif\" BORDER=0></a>");
                out.println("</td>");
                out.println("</tr>");
                out.println("<tr>");
                rs.close();  
                stmt.close();
                out.println("</form>");
                out.println("</table>");
                out.println("</body>");
                out.println("</html>");
                out.close();
            catch (Exception e)
                //sendErrorToClient(out, e); //send stack trace to client
                System.out.println(e.getMessage());
            finally{
                //return connection to Pool
                connectionPool.returnConnection(dbConn);
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, java.io.IOException {
               response.setContentType("text/html"); //html output
               PrintWriter out = response.getWriter();
               Connection dbConn = null;
               //get the parameters posted back by processPOItem servlet
               String processingAll = request.getParameter("processingAll");
               String deliveredAll = request.getParameter("deliveredAll");
               String deliveredDate = request.getParameter("deliveredDate");
               String refInvoice = request.getParameter("refInvoice");
               String refNumber = request.getParameter("refNumber");
               //String status = request.getParameter("status");  
               //check if update button is pressed
               String updatePO = request.getParameter("updatePO");
               //sql statement variable
               String sqlUpdatePOStatus;
               String isbn, poItemStatus;
               //update button was pressed
               if (!updatePO.equals(""))
                try{
                    //get the SQL statement
                    String SearchPOItems = searchSQL(strPO);
                    //get free connection pool
                    dbConn = connectionPool.getConnection();
                    //create a statement object
                    Statement stmt = dbConn.createStatement();
                    //create the recordset
                    ResultSet rs = stmt.executeQuery(SearchPOItems);
                    int index = 0;
                    //display the recordset
                    while (rs.next())
                      isbn = rs.getString("mb_ISBN");
                      poItemStatus = request.getParameter("mb_Status" + isbn);
                      out.println(isbn + " " + poItemStatus);
                      out.println("<br>");
                      //update the status of individual PO item
    if (!poItemStatus.equals(""))
    sqlUpdatePOStatus = updatePOItemSQL(strPO, isbn, poItemStatus);
    stmt.executeUpdate(sqlUpdatePOStatus);
                    rs.close();  
                    stmt.close();
                    out.close();
                catch (Exception e)
                    System.out.println(e.getMessage());
                finally{
                        //return connection to pool
                        connectionPool.returnConnection(dbConn);
    }When I perform a form submit in my doGet() method, the doPost Method() responsed. However, it encounter error in updating the second row in the recordset as highlighted in bold.
    After the first row is updated. The second row did not get updated at all.
    The error return was "Resultset is closed".
    What actually is wrong? How can I execute a sqlstatement inside a recordset? How to solve this problem?

    Did you turn on the "updatable" switch for the result
    set?
    public Statement createStatement(int resultSetType,
    int resultSetConcurrency) throws
    SQLException
    Parameters:
    resultSetType - a result set type; see
    ResultSet.TYPE_XXX
    resultSetConcurrency - a concurrency type; see
    ResultSet.CONCUR_XXX
    static int CONCUR_UPDATABLE
    JDBC 2.0 The concurrency mode for a ResultSet object
    that may be updated.Hi,
    do you refer to the following change of code:
    //create a statement object (original)
    Statement stmt = dbConn.createStatement();change to the following:
    //create a statement object (original)
    Statement stmt = dbConn.createStatement(resultSetType,
    resultSetConcurrency);when I use another statement object for executeupdate, what I got was the connection was used by another hstmt. Thus the second column was not updated at all.
    Why?

  • HT1349 I can not run the scanner in my main user, but only the second user and the same thing with updating apps! Why is this happening???

    I can not run the scanner in my main user, but only the second user and the same thing with updating apps! Why is this happening???

    Welcome to the Apple Community.
    Enter the details of her second account at system preferences> mail, contacts & calendars.

  • Unable to get the composite instance for the invocation. This could be because instance has not yet been created or because the audit level for the SOA infra has been set to Off

    I am on Oracle 11.1.1.7 BPM suite on W8 64 bit. I can't launch the flow trace and get the error "Unable to get the composite instance for the invocation. This could be because instance has not yet been created or because the audit level for the SOA infra has been set to Off".  I have set the audit level to development at the soa-infra>SOA Administration> Common Properties > Audit level set to development and Capture Composite Instance State is Checked.
    Can somebody advice.
    Thanks

    Can you please confirm me the following steps...
    Log in to the EM console, Expand soa-infra (soa_server1) , go to the partition where your composite is been deployed, Click on your composite, On the right, click on the dropdown Settings and choose Composite Audit Level. you can choose to set the Audit Level for this composite. If you choose Inherit, it will take the settings to what the server is being set to. Otherwise, we can override it by choosing Off, Production, or Development.
    Make sure your setting for that composite is not Off, keep inherit or production or development.
    Thanks,
    N

  • Enterprise Manager is not able to connect to the database instance. The sta

    Enterprise Manager is not able to connect to the database instance. The state of the components are listed below.
    Listener is shown as unavailable.
    lsnrctl status
    LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 27-NOV-2012 11:52:40
    Copyright (c) 1991, 2009, Oracle. All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=freds-server.i-surname.co.uk)(PORT=1521)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
    Start Date 27-NOV-2012 11:50:02
    Uptime 0 days 0 hr. 2 min. 37 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /opt/oracle/11g/network/admin/listener.ora
    Listener Log File /opt/oracle/diag/tnslsnr/freds-server/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=freds-server)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=freds-server)(PORT=8080))(Presentation=HTTP)(Session=RAW))
    Services Summary...
    Service "GWORCL.i-surname.co.uk" has 2 instance(s).
    Instance "GWORCL", status UNKNOWN, has 1 handler(s) for this service...
    Instance "GWORCL", status READY, has 1 handler(s) for this service...
    Service "GWORCLXDB.i-status.co.uk" has 1 instance(s).
    Instance "GWORCL", status READY, has 1 handler(s) for this service...
    The command completed successfully
    I suspect that this is not just an OEM issue.
    see
    Listener working but not working for Enterprise manager oracle 11gr2 Linux.
    for configuration files
    Edited by: Neill_R on Nov 27, 2012 11:51 AM

    This was solved by : Osama_mustafa
    in the general questions forum
    emca -deconfig dbcontrol db -repos drop
    emca -config dbcontrol db -repos create

  • Enterprise Manager is not able to connect to the database instance. The state of the components are listed below.

    Dear all,
    I have trouble to connect em console to database instance. My database is 11.2.0.3 and before this I did the patching from version 11.2.0.1, and now i cannot get fully functionality of em console.
    error is:
    Enterprise Manager is not able to connect to the database instance. The state of the components are listed below.
    It shows that agent is connected, database and listener is up.
    I did recreation, dropping and recreating with emca, but no success.
    Did anyone have similar problems with em console?
    Regards,

    You need to first of all, Connect to the Database as SYSDBA (because your were not connected), then start the database (because it is not started).
    If you already used the username and password in the command prompt and you are sure that the database is already stared, then you need to set the ORACLE_SID before you open SQLPlus. This is because if SQLPlus does not know the SID you are connecting to, it simply thinks it is not up or has no service hence the message "Connected to an idle instance".

  • When I open a second Profile while another is running the second cannot access the Internet until I close the first. Why?

    I often have occasions to run more than one Profile simultaneously (usually because of different add-ons I've installed on different Profiles). In the past this worked fine. Now, all of a sudden, if I open a second Profile while the first is running the second cannot access the Internet until I close the first. It keeps looking for a website, and failing, until the system "times out". If I close the first Profile, the second is then able to access the Internet.
    Note: this is not a problem with opening a second Window in Firefox. As long as they are from the same Profile they will both work fine. Nor does this stop me from using a second Profile to look at website files I have saved to my computer. The only problem is that the second Profile cannot get on the Internet.

    I just checked, the setting was for "Automatic proxy configuration URL", in the past it was set on "No Proxy". So I'll try changing that (and/or try other proxy options), and see if that solves the problem.
    If it does, then just one (academic) question remains: why did that happen in the first place? I don't care what the answer is, so long as your suggestion solves the problem.
    Thanks.

  • TS1702 We use one ID for  the Apps store for 2 iPhones. In the second profile on the Macit is impossible to update apps there is a mistake. What is the decision?

    We use one ID for  the Apps store for 2 iPhones. In the second profile on the Macit is impossible to update apps there is a mistake. What is the decision?

    This happens when you both use the same Apple ID for iMessage.  To fix this you have two choices:
    On one of the phones go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign back in with a different ID.  Note: you can still share the same ID for purchasing in Settings>iTunes & App Stores; or
    On both phones go to Settings>Messages>Send & Receive and uncheck the email address(es) shown under "You can be reached by iMessage at".  Also uncheck the other phone's phone number, if present.

  • On my iPod touch, in my music library, I have 2 tracks of the same song on a few of the albums. How do I delete the second track of the song?

    On my iPod touch, in my music library, I have 2 tracks of the same song on a few of the albums. How do I delete the second track of the same song?

    Hey glocster,
    Thanks for using Apple Support Communities.
    Looks like you have a song you want to remove from your iPod. This article tells you how to delete content from a lot of places.
    How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    iPhone, iPad, or iPod touch
    Tap the Music app.
    Tap the Songs category.
    Swipe left over the song you want to delete.
    Tap Delete.
    Have a nice day,
    Mario

  • In BAM, how to get activity ID for the running instance in the orchestration.

    I am trying to add document reference URL to the active instance in the orchestration for the activity which is already started.
    Please let me know how to get such activity ID.
    Thanks
    Jagadeesh 
    Jagadeesh RS

    Are you using TPE to set up the Activity Tracking or BAM API. If you are using TPE then identify what has been set as the Activity Id in the BTT file. If the Message Id is used then use "BTS.InterchangeID" [refer
    http://msdn.microsoft.com/en-us/library/aa562116.aspx] on the received message to get the Activity Id.
    If however you've mapped the Activity Id in BTT to the InstanceId then use
    "Microsoft.XLANGs.Core.Service.RootService.InstanceId"
    to get the activity id.
    Regards.

  • My iPhone 4S is dark, this is the second time.  The first time i was able to get it back on by plugging in into my PC.  However this time i have had it plugged in for an hour or so and nothing.  I have done the Start/sleep buttons

    My iPhone 4s is dark, this is the second time.  The first time I was able to get it back up and running by plugging it into my PC.  However this time it has been plugged in for an hour or more and nothing. There was still at least 70% charge left on it when it went dead.  I have pressed the sleep and start button separately and together.  It said that I did not have much space left this morning so I deleted Apps and photos but there was still space.  Just two days ago it was losing power even though it still 55% charge left so I plugged it in and it seemed to gain power.  Any suggestions on the problem?

    Sounds like faulty battery. Make Genius reservation and take to Apple for quick (minutes) free battery diagnostic testing. If you have Warranty or AppleCare the problem will be covered.

  • How can I log into two differant accounts at the same time in two windows without the second window affecting the first.

    I'm trying to log into two facebook accounts at the same time in differant windows. When ever I log into the second account in the second window it changes the login in the first window. When I hit home or any other link the first window account has been logged out and logged into the second window account. I tried installing a second copy of firefox in a differant folder that the first but it seems to use all the files of the first installation. If I can get 2 toatally seperated instalations that don't rely on the same history, cookies, cache, etc I belive that will solve my problem. Please help.
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)

    Nah, that won't work. Facebook has a feature that gets your IP Address, so as soon as you sign into one on the same computer, it changes the other login for safety purposes (say, someone was on a public library PC. They forgot to log out. Someone else logs in, and it automatically logs them out). You'll need 2 computers to do that.

  • How to call the second mapping in the first mapping fails in the BPM

    Hi All,
    I have a scenario like this.
    There are two mappings. There is a one condition while genearying the root element of the first mapping. If this condition is not satisfies the first mapping will fail. If this mapping fails i want to trigger another mapping.
    How to achieve this functionality.
    If it is possible with BPM. how to call the second mapping in the BPM.

    Hi
    you can not create the containter for the synchronous interfaces.
    you have to craete the two asysnchronous abstact interfaces .
    thenusing those two abstract interfaces you have to define the containers in the BPM.
    and you also have to define the interface mapping b/w those two abstract interfaces.
    once you define the interface mapping you will be able to select the interface mapping using the transformation step in BPM.
    once you select the interface mapping in BPM then you will be able to selece the interfaces
    if you still face the problenm please reply me back.
    Thanks
    Rinku Gangwnau

  • Display Text in the Second page of the Report.

    Dear,
    I have a Report With Group G_Emp, having Columns Eno, Ename etc. in a Repeating frame R_1 and
    I have put A frame below this repeating frame R_1 with a Text Item Just for Displaying Comments, so just i want to display this Text Item in the second page and the Employee details in the first page, the restriction is that the Text item should not print in the first page.
    I hope you understand,
    pls help.
    Stalin Ephraim...

    Hi,
    if i understand well you could maybe try this :
    or ) for your A frame below the repeating frame specify break page before = YES
    or ) and if i understand your meaning correctly you want your comment to show once, on a seperate last page -->
    in your layout section move the sdesign for your A frame from the main section into the traileer section.
    regards, E.

  • Desktop icon for a file on network shows blank in Windows 8.1, if selected the second icon from the library

    Hello, 
    I have a strange issue on my Windows 8.1 machine. The icon for for an executable file on the network shows blank, if I select the second icon from the library. (File->Properties->Change Icon and select the second icon - This file has two icons)
    If I re-create the IconCache.db, then it is showing correctly. But I do not want to do this every time. 
    Regards
    Mattehw

    It indicates your Icon Cache is corrupted and you need to rebuild it.
    Open the command prompt window, type each of the following and after every command, hit the Enter button:
    cd /d %userprofile%\AppData\Local
    attrib –h IconCache.db
    del IconCache.db
    start explorer
    S.Sengupta, Windows Entertainment and Connected Home MVP

Maybe you are looking for

  • Refresh a materialized view partition

    Hi, We have Oracle 10.2.0.3 DB and have a fast refreshable MV. We are planning to list partition it and would like to know if a partition can be "individually" refreshed. I looked at the PL/SQL supplied packages doc (for dbms_mview) and DW guide and

  • ISync not finding Calendars in iCal

    To begin, I have "upgraded" to 10.5.3. I just attempted to sync my cellphone with my Mac, and noticed that iSync was not recognizing any of my calendars in iCal. When I clicked on the Calendars box in iSync, I got the following message: No writable c

  • I cannot pass information from my Mac to my external hard drive, what can I do?

    Hello, This is my first Mac and I am new to all of it. I have an external hard drive that I use to use with my old PC . On the external hard drive box it says its compatible with both windows and Max os x. I can pass files from my external hard drive

  • Regex: Remove Date from File Names Sitewide

    I'm trying to avoid  hundreds of 301 redirects across my site. I have two kinds of links that need a regex search string which will simply remove numbers that precede text within html files. The existing .html files are named with text only (e.g., na

  • How to edit Text Files?

    Hi, I have a text file with sample data like this. Nokia|25 Motorola|30 LG|20 Samsung|50 Sony|25 I will get an argument like ‘Nokia’. I need to compare it with the data in the file. If I find a matching record in the file, I need to decrement the qua