How do i have an auto number in browser tab?

Discussion in 'Programming' started by demondestiny, Aug 31, 2011.

  1. #1
    I am currently building a web email client and i was wondering how to code a function into it that shows a number appear telling you that you have unread mail if you are viewing another tab. Heres an example of what i mean if you don't understand.

    [​IMG]

    That is an example of what i mean from hotmail. If i'm in another tab and an email comes through it comes up with a 1.

    How do i go about coding this into mine? Any help would be much appreciated.
     
    demondestiny, Aug 31, 2011 IP
  2. ssmm987

    ssmm987 Member

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    3
    Trophy Points:
    43
    #2
    With the use of Ajax, you can periodically load a page which displays how many unread emails you have recieved. When this is not zero, you can change the title tag.

    Example using jquery:
    
    $.POST("ajax/check.php","",function(data){
         if(data==0)document.title="Title";
         else document.title = "Title ("+data")";
    }); 
    
    Code (markup):
     
    ssmm987, Sep 1, 2011 IP