dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: Hide or close the browser tab when its inactive using native javascript?

  1. #1
    Join Date
    Jul 2014
    Posts
    2

    Hide or close the browser tab when its inactive using native javascript?

    How to hide or close the browser tab when this tab is inactive, or the user switch into another tab using pure JavaScript?

    Example: When the tab is open the Google Map, and the user switch into another tab, the Google Map tab will be hide or close. Thank you

    I'm new in javascript. Please help me

  2. #2
    Join Date
    Mar 2012
    Posts
    1,840
    Why do you want to do this? If you could hide/close inactive tabs, how would you switch ti another tab (apart from <ALT><TAB> keystroke) - there would not be any tabs to switch to. Have you thought this through?

  3. #3
    Join Date
    Jul 2014
    Posts
    2
    Quote Originally Posted by jedaisoul View Post
    Why do you want to do this? If you could hide/close inactive tabs, how would you switch ti another tab (apart from <ALT><TAB> keystroke) - there would not be any tabs to switch to. Have you thought this through?
    Because I need this to my current project that I doing right now. I want to automatically close/hide the browser tab if the user is switch into another tab or tab is inactive. Will you please help me? I search and reading lot of questions and articles about this topic but no update answer

  4. #4
    Join Date
    Mar 2012
    Posts
    1,840
    Sorry I can't help, I'm not a JavaScript coder. It just occurred to me that the concept was potentially flawed anyway... Have you seen anywhere where this functionality is implemented? If so, you should <ctrl>U or <ctrl>P the page and study it. That, or at least give us a link to it, so we can see the functionality you are seeking to implement...

    By the way when you say "hide" do you mean that the tabs will automatically display when moused over? If so:
    1. That is very different from closing the tab.
    2. What about mobile users (who do not have hover functionality)?

    By the way, I appreciate that I may be asking questions that are not directly relevant to the task you have been set. However, thinking around the objective could lead to a better solution than focusing simply on the task as set...
    Last edited by jedaisoul; 07-18-2014 at 05:02 AM.

  5. #5
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,519
    Wouldn't opening a new web page with a reference in the opener to test if the page opened and loaded then self close the page that opened the new page work?

    I have to agree, that kind of functionality doesn't seem to have any legitimate purpose.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles