Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8949173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:10:27+00:00 2026-06-15T13:10:27+00:00

I have created a news feed script which automatically informs the user when new

  • 0

I have created a news feed script which automatically informs the user when new news items are available, like on twitter. I want to add this alert to the title so used this;

var originalTitle = document.title;
document.title = '(' + result + ') ' + originalTitle;

Now I don’t see the problem but it appends the result value before the originalTitle which would be fine if it wasn’t costantly being updated whenever there’s new news.

E.g; If 1 story is added and not another for a long time you get this;

(1) (1) (1) (1) (1) (1) title 

E.g 2; If stories keep on getting added you get this;

(5) (4) (3) (2) (1) title

Not pretty. I want the while title to be rewritten each time and not just have the result appended infront each time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:10:28+00:00Added an answer on June 15, 2026 at 1:10 pm

    It looks like originalTitle is being over-written each time with whatever happens to be the title at the moment, which is why you’re winding up with (5) (4) ... title

    Just save the original title in one place, with the line of code you already have.

    var originalTitle = document.title;
    

    Call that line in your document.ready handler, and leave it alone. Then each time you want to update the title, this should do what you want

    document.title = '(' + result + ') ' + originalTitle;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a news feed where items in the feed are created from JSON
I have created a form for my news articles which I then call to
I have page named page--news.tpl.php, which i created for my news page. But after
from a PHP script I'm downloading a RSS feed like: $fp = fopen('http://news.google.es/news?cf=all&ned=es_ve&hl=es&output=rss','r') or
Given you have to implement a news feed like the one seen in social
I have created an application that looks like a news ticker. It suppose to
I have written a script that takes an XML feed of some news, and
On a news-feed page I've created I have a list of snippets with information,
I have a page that is loading a script from a third party (news
i have created view , in short it display last 5 news title and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.