# Does any site provide this html code?  (auto-updated team scores)

**URL:** <https://boards.straightdope.com/t/does-any-site-provide-this-html-code-auto-updated-team-scores/367889>\
**Category:** Factual Questions\
**Created:** [August 8, 2006, 6:01pm UTC](https://boards.straightdope.com/t/does-any-site-provide-this-html-code-auto-updated-team-scores/367889 "2006-08-08T18:01:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![clayton\_e](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@clayton\_e](https://boards.straightdope.com/u/clayton_e)\
**Post date:** [August 8, 2006, 6:01pm UTC](https://boards.straightdope.com/t/does-any-site-provide-this-html-code-auto-updated-team-scores/367889/1 "2006-08-08T18:01:51Z")

</div>

I was thinking of ways to brag about a sports team I like on my myspace profile. Is there any site that provides code that updates itself automatically?

I was thinking of something like this:

Team: W## L##

## games ahead

Has it been done?

Thanks in advance…

-C\_e

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [August 8, 2006, 6:17pm UTC](https://boards.straightdope.com/t/does-any-site-provide-this-html-code-auto-updated-team-scores/367889/2 "2006-08-08T18:17:03Z")

</div>

HTML code can’t update itself automatically. If you really felt like it, you could write some Javascript to fetch the scores from somewhere and dynamically write them per-request.

The website that you scrape them from might not appreciate it, though.

---

<div class="post-metadata">

**Author:** ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)\
**Post date:** [August 8, 2006, 7:20pm UTC](https://boards.straightdope.com/t/does-any-site-provide-this-html-code-auto-updated-team-scores/367889/3 "2006-08-08T19:20:30Z")

</div>

[QUOTE=friedo]  
. . .you could write some Javascript to fetch the scores from somewhere and dynamically write them per-request.  
[/QUOTE]  
Really? I thought you had to use server-side programming to do that. How do you do it with JavaScript?

---

<div class="post-metadata">

**Author:** ![friedo](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@friedo](https://boards.straightdope.com/u/friedo)\
**Post date:** [August 8, 2006, 7:30pm UTC](https://boards.straightdope.com/t/does-any-site-provide-this-html-code-auto-updated-team-scores/367889/4 "2006-08-08T19:30:19Z")

</div>

[QUOTE=CookingWithGas]  
Really? I thought you had to use server-side programming to do that. How do you do it with JavaScript?  
[/QUOTE]

Oops, I think you’re right. I tried doing it using an XMLHTTPRequest to fetch a foreign URL, but it appears to be a security violation.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [August 8, 2006, 8:39pm UTC](https://boards.straightdope.com/t/does-any-site-provide-this-html-code-auto-updated-team-scores/367889/5 "2006-08-08T20:39:19Z")

</div>

You sure you can’t pull it from a webservice with the appropriate client-side jscript code?

---

<div class="post-metadata">

**Author:** ![DiggitCamara](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@DiggitCamara](https://boards.straightdope.com/u/DiggitCamara)\
**Post date:** [August 8, 2006, 10:46pm UTC](https://boards.straightdope.com/t/does-any-site-provide-this-html-code-auto-updated-team-scores/367889/6 "2006-08-08T22:46:23Z")

</div>

Actually, the XMLHTTPRequestObject would be the way to go (Microsoft has some pages documenting the feature [here](http://search.msdn.microsoft.com/search/default.aspx?siteId=0&tab=0&query=XMLHTTPRequest+).

Of course, you’d have to parse the page to find where the scores you want to pull are, but most teams have their own webpages and publish their scores on the front page.

However, the code will break any time the page is modified…
