Need help? Check out our Support site, then

How on earth do these sites update images constantly for widgets?

  1. bloggersanjida

    this isn't totally wp related, but partially, yes.

    1. flickr, facebook, mybloglog....and numerous other sites. how do they do it really?

    everytime they have new info for a specific "badge", the badge is visually updated. what is the code they are using?

    2. would it be possible to randomise images in a js-compatible website and get the images to appear in a wp .com blog using an html code?

    3. to prevent hotlinkng, some people resort to switcheroo, which is basically a single image. is it possible for switcheroos to enable different images to appear according to specifically set commands?

    if anybody here knows the secret formula, please share!
    an artist or image-hungry blogger can greatly benifit from things like this.

  2. The answer is in your tag - javascript.

  3. bloggersanjida

    thanks tt,

    um, does anyone know exactly which javascript code is responsible for all this voodoo?
    and where i can get the codes?

  4. It's dependent on which service you are looking at. Each will have the javascript written specifically for their requirements. Also makes it pretty damned hard to rip it off. I would suggest that you google for javascript and look at one of the one million or so results that come back. It's bound to be on a JS dedicated website somewhere.

  5. bloggersanjida

    thanks cornell,
    i guess there are no quick hacks on this one ;)

  6. One should also proceed with caution when asking for codes as you do as javascript can be used for malicious purposes. Perhaps reading this will will be helpful.

    Why javascript is stripped
    Blogs are served from {name} The WordPress cookie is delivered to any site that ends in Any Javascript on the page is legitimately allowed to look up cookies that would be sent to the domain it’s served from.

    This means that if you can run Javascript on a hosted WordPress page, you can retrieve the login cookie from another WordPress user, and then pass it to an external site. (Generally by creating an image reference that includes the encoded login cookie.)

    This is just a basic part of the underlying technology of the web browser, and it’s required for sites like gmail, Yahoo!, and others to operate.

    There are ways a site can avoid this problem (generally by constantly changing the login cookie data with EVERY response, and invalidating the old ones immediately), but they require more horsepower on the backend than the blogging sites are really able to provide, and there’s still usually a small window of opportunity for security breach.

    This is why Livejournal, WordPress, and most other hosted sites disallow Javascript on their pages.

  7. It's a theoretical discussion anyway, since we cannot use javascript at all on our blogs. If it involves javascript, it's irrelevant to blogging; really, it is as simple as that.

  8. Granted that is as simple as you state, however, explanations can be useful when it comes to answering the "why?" questions.

  9. bloggersanjida

    thank you all,
    i am still a hopeless hopeful, despite all the explanations.

    i mean if those sites can do it - via js or whatever - then surely there is a way i can do it too.
    i will just keep my fingers crossed.

    thanks for the responses.
    i wonder if those sites will reveal their secret if i ask directly? i will try, what do i have to lose anyway? ;)

  10. Yes, you can do it. No, you cannot do it on a blog, that's all.

  11. bloggersanjida

    there might be a roundabout solution,
    i mean i will link to the js-or-whatever enabled stuff via html coding.
    which means technically speaking, i am not using js directly here at wp .com at all!

    perhaps these sites have special permission from automattic? in that case, i think i should contact support first to see what the deal is. Maybe there are some tos involved.

  12. No. Javascript-based widgets do not work at If you want to use them, you will have to use them on another site.

    You cannot get javascript functionality out of non-javascript code.

  13. bloggersanjida

    thanks for your explanations raincoaster!

    cos it means i don't have to hunt for the right js code out of millions of js codes, as cornell suggested.

    um, if they don't do it via js, do you have any idea how those sites do it? if you are lost on what i mean, just skim the first post!

  14. If you are talking about the constantly-updating-right-before-your-eyes widgets, that's javascript. No sites on can use javascript, except possibly the VIP sites (although perhaps not even them).

  15. bloggersanjida

    i am not a vip. but still these badges are constantly updated! :)

    or anybody who uses flickr in their free wp site, they have constantly updated photos from their flickr album!

    perhaps there IS a deal between these sites and automattic. I mean something is going on somewhere...

  16. No, there is a difference between constantly updated before your very eyes and updated every time you load the page. They are completely different things. It appears you have been asking for the wrong thing.

  17. bloggersanjida

    i'm truly very sorry for all the confusion. I am still too new to understand all the nuances.

    um, do you have any idea how these sites do it the way they do it?
    i am ok with the way they are doing it, instead of the right-before-your-eyes voo doo.

    any quick hacks? ;)

  18. No idea. You could look for the code in View Source and try and sift it out.

  19. bloggersanjida


    i will keep my fingers crossed.

  20. Apology accepted. In the future, it's probably best if you provide a direct link to a blog that has what you're talking about. Then we wouldn't get off course.

    You could make an animated gif that's nothing more than a blinking slideshow of images and upload that like a regular picture. Not sure how you do that, though.

    I think widgets like the Weather Fairy fetch the pic from the source site, which continually changes the the image it wants to display on the home site, so it looks different to all the sites using the widget and linking to the pic with that URL. No idea how they do that but I think it would be complicated to code.

  21. The best way to learn how to code is to learn how to code. Picking up javascript snippets of this and that code and "quick hacks" doesn't seem like a wise course of action to me, given that they can have malicious purposes and that you don't know enough to differentiate between the good and the bad.

    More to the point, all javascript snippets will be utterly useless to you given that the software will strip them right out, hence, it's seems to be a waste of time and energy collecting them and acting like they are the holy grail or something.

    I cannot fathom how these quests for sidebar "tat" that you embark upon can be expected in any way, shape or form to enable you to become a better blogger. Only one thing does that and it is focusing your energy and time on creating quality content.

  22. bloggersanjida


    oh i do know how to make slide shows of animated gifs! but that doesn't quite cater to my needs. bcos it is non-changing - the images don't update all by themselves! i think i will try to sift the code from weather pixie.

    where are all those hard-core bloggers when you need them?

    you don't get me at all, do you? ;)
    i whole-heartedly appreciate your suggestions, but i am sorry to say, you don't actually recognise my need for images. maybe i will be blogging about sidebar tat! on a more serious note, my blog - at least one of them - will focus on my images and how to spread them in blogs.
    i don't think you understand the purpose, but please, at least be tolerant! honestly, i think we are both getting tired arguing about tat.
    as for picking up js codes from here and there, people do it all the time. there are many trusted sites. and it doesn't hurt to try!
    and don't worry about me trying out js here. i have mentioned already in the first post that i will do it elsewhere and LINK to it via html in my wp blog.

    ps: @raincoaster, if you ever need to have a slide show of animated gifs, just holler! i will be glad to help! just supply me with the images!
    and why i will do this? well if you want to know, just ask!

  23. bloggersanjida

    i meant hard-core coders, not bloggers.

    i just copied code from thefeedictionary from
    view>source as rain suggested.

    guess what, it scrolled a mile both up-and-down and sidewise in my notepad file.
    so i pasted it in ms word for convenience and i have 41 pages of code.
    ooh, we are on a treasure hunt here!

    this might interest you, i don't know. you have an environmental blog, don't you?
    if you know what code thefreedictionary is using to constantly update their stuff on blogs, you can benefit from it too! i mean, you can then ask people to get the code and then automatically your er, input will be updated in their blog!
    since you are a word-person, as opposed to an image-person, and and have er, green concerns, i think something like what freedic uses can help you to raise awareness among people. i mean, all they have to do is update a simple HTML code and they will have new messages. In no other way can you hope to deliver info automatically so simply to a number of blogs!

  24. Except via RSS feed.

  25. bloggersanjida

    rss is neat i suppose!

    but a regularly updated widget has the added advantage of making the info visible not only to a blog's owner, but also to the visitors of that blog.

    i understand that probably most of the bloggers don't really care about this, though.

  26. bloggersanjida

    i've been seeking help from some sites. and i finally have an answer. and it is bad news for me, js has nothing to do with it! it's php and some other stuff - both 100% greek to me.

    Originally Posted by sanjidas
    I am mesmerised. How do Flickr, mybloglog, facebook and numerous other sites update their badges eberytime the information is updated? Someone told me it is done with js.
    I hava a blog, which means i am not allowed to use javascript there. so i have to link my images updated in another site only via html in order for them to show up in my blog.
    Also is it possible to randomise images in another site and link to it via html for my blog? so that, for example, i can have one image at morning and another at evening?
    Thanks in advance! 
    You mean like, where you have your picture posted somewhere, and it changes?
    For instance, on your forum signature, every time a page loads, it will show a different picture?
    I've heard of people doing it with PHP before, but I don't think I've seen it with Javascript. Basically how people do it with PHP is to set up PHP to handle the JPEG or other image formats, then use either filesystem functions to read the images in binary, and transfer them, with the correct Content-type headers, or they do it with the Image Library functions (I think its gdd), and the correct content-type headers.


  27. We cannot access files underlying our templates at Hence we cannot alter the php. If we could then every edit we made would likewise effect all other blogs with the same theme on this multi-user blogging platform.

  28. bloggersanjida


    i am sorry if i confused you. i won't do anything here - i already made it clear twice. i only need a regular html code to link stuff here from another site. like they do at thefreedictionary.

    the only thing i am allowed to paste here codewise is html, i know the rules :)

    anyway, i don't think that project of mine is going to see daylight any time soon, since i'm a dunce concrning php or ggd.

    i do appreciate your concern, though!

Topic Closed

This topic has been closed to new replies.

About this Topic