Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. How I can close current tab in a browser window using JavaScript?

How I can close current tab in a browser window using JavaScript?

Scheduled Pinned Locked Moved JavaScript
javascriptquestion
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_14713926
    wrote on last edited by
    #1

    I am looking for a method to close the current tab of the browser window using JavaScript.

    B 1 Reply Last reply
    0
    • M Member_14713926

      I am looking for a method to close the current tab of the browser window using JavaScript.

      B Offline
      B Offline
      Blikkies
      wrote on last edited by
      #2

      Unfortunately you can't for security purposes. You can only close windows that were opened by Javascript.

      M 1 Reply Last reply
      0
      • B Blikkies

        Unfortunately you can't for security purposes. You can only close windows that were opened by Javascript.

        M Offline
        M Offline
        Member_14713926
        wrote on last edited by
        #3

        In earlier time it was possible to close the current tab by using the window.close() function. The following syntax was used at that time: Syntax: window.close(); I read This here- How to close current tab in a browser window using JavaScript ?[^]

        Z F B 3 Replies Last reply
        0
        • M Member_14713926

          In earlier time it was possible to close the current tab by using the window.close() function. The following syntax was used at that time: Syntax: window.close(); I read This here- How to close current tab in a browser window using JavaScript ?[^]

          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #4

          Member 14713926 wrote:

          window.close();

          If you know about this, why are you asking then?

          Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

          Richard DeemingR 1 Reply Last reply
          0
          • Z ZurdoDev

            Member 14713926 wrote:

            window.close();

            If you know about this, why are you asking then?

            Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

            Richard DeemingR Offline
            Richard DeemingR Offline
            Richard Deeming
            wrote on last edited by
            #5

            Because it's an excuse to post a link to his spam "best programming tutorials" site. :laugh:


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

            Z 1 Reply Last reply
            0
            • Richard DeemingR Richard Deeming

              Because it's an excuse to post a link to his spam "best programming tutorials" site. :laugh:


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              Z Offline
              Z Offline
              ZurdoDev
              wrote on last edited by
              #6

              Richard Deeming wrote:

              "best programming tutorials"

              I could use some of that.

              Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

              1 Reply Last reply
              0
              • M Member_14713926

                In earlier time it was possible to close the current tab by using the window.close() function. The following syntax was used at that time: Syntax: window.close(); I read This here- How to close current tab in a browser window using JavaScript ?[^]

                F Offline
                F Offline
                F ES Sitecore
                wrote on last edited by
                #7

                In earlier times you got the full client path from a file upload and we were running ActiveX on our web pages. What's your point?

                1 Reply Last reply
                0
                • M Member_14713926

                  In earlier time it was possible to close the current tab by using the window.close() function. The following syntax was used at that time: Syntax: window.close(); I read This here- How to close current tab in a browser window using JavaScript ?[^]

                  B Offline
                  B Offline
                  Blikkies
                  wrote on last edited by
                  #8

                  That is why websites were easily hacked in the earlier times due to inefficient security. Like I said, javascript can only close windows that was opened by it.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups