A logout button, php page

enisione -  
lekobus Posted messages 13 Registration date   Status Member Last intervention   -
Hello,

I have a Firefox browser.

I have a web application and I need to create a button that closes the tab.
I want to create a close button with PHP, JavaScript, HTML, or a combination of all three. Its role is to close the tab.

8 answers

  1. MastercroW Posted messages 1259 Registration date   Status Member Last intervention   163
     
    Good evening,
    To close your page, you simply use the window.close() function! You can place this function wherever you want: in a text link, an image link, or, as shown below, a real form button:
    <input type="button" value="Close" onClick="window.close()">
    4
    1. ghuysmans99 Posted messages 2496 Registration date   Status Contributor Last intervention   342
       
      And no: http://img337.imageshack.us/img337/7491/windowclosefirefox.png
      0
  2. ghuysmans99 Posted messages 2496 Registration date   Status Contributor Last intervention   342
     
    (Cannot be PHP as it executes on the server side and not entirely HTML since it's for formatting). Not possible: a JS code cannot destroy a window it did not create itself.
    --
    Google is your best friend
    VB.NET is good ... VB6 is better !
    0
  3. enisione
     
    ```javascript
    // Pour ouvrir un nouvel onglet avec JavaScript, utilisez la méthode window.open().
    window.open('https://www.example.com', '_blank');
    ```
    0
  4. enisione
     
    How can we proceed?
    I would like a solution on Firefox, please.
    0
  5. ghuysmans99 Posted messages 2496 Registration date   Status Contributor Last intervention   342
     
    There isn't any to my knowledge ...
    --
    Google is your best friend
    VB.NET is good ... VB6 is better !
    0
  6. MastercroW Posted messages 1259 Registration date   Status Member Last intervention   163
     
    Good evening,
    Ghuysmans99 I don't know what you tested because for me with Opera it works very well, it automatically closes the tab when you click on "close". Maybe Mozilla displays it incorrectly.
    Anyway, I'll give you the complete code again:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>

    <body>
    <input type="button" value="Close" onClick="window.close()">
    </body>
    </html>

    PS: Try with several browsers
    0
    1. ghuysmans99 Posted messages 2496 Registration date   Status Contributor Last intervention   342
       
      Doesn't work on FF and under IE8 it asks for confirmation to close the window.
      0
  7. MastercroW Posted messages 1259 Registration date   Status Member Last intervention   163
     
    As for IE8, no button can close the window without a confirmation request, or a script error, etc.
    0
  8. lekobus Posted messages 13 Registration date   Status Member Last intervention  
     
    Hi Mastercrow, your code works well with Opera, but it doesn't work with Firefox. How can I make it work with Firefox?
    Thank you for your help. a++++++++
    0