Support » Fixing WordPress » Javascript for auto refreshing one page once

  • Hi, I,m running an ajax site powered theme on my website and I’ve got an issue with one of my posts only showing thumbnails after being refreshed no matter what browser I use, I’ve tried a plugin that auto refreshes a single page but that didn’t work maybe cause its an ajax site and it also didn’t have the option to refresh the page/post once only in seconds, my question is, is there any javascript code I could add to my theme’s custom Javascript field that would refresh just the post I want once with no time caps, without having to refresh the post over and over again, I already found a code somewhere but it only worked for the homepage of my website, I would like to specify just a post. I know its possible. Please help me guys. 🙂

    This worked for me but it only refreshed my homepage, I want to refresh just one post

    window.onload = function()
    if (!
    setTimeout(“window.location+=’?refreshed’;”, .1000);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Josh


    Moderator and Editor Customizer

    Hi there,

    If you are having to ‘fake’ a page reload.. then chances are something in your coding is off. Perhaps it is the hook you are using; or something in your Ajax is not firing at the right time.

    There should be no need to have to force a page reload. If you would like to post some of your code to; I’ll take a quick look.

    But, to answer your question, you can use the javascript reload() method to force a page reload.

    Hi, I’m so sorry for taking so long to reply,
    1) I don’t really understand what you mean by pasting my code on pastebin, I could do that but I don’t know which file’s codes of my theme to paste.

    2) My theme’s custom javascript field requires I have the <style> tag in whatever code I want to paste there, how do I go about adding that tag to the reload() method and ForceGet too, cause it takes an actual click of the reload button in my browser for the thumbnails on my site to look better.

    3) Is there a way I could specify just one link to be reloaded in the code as the issue I’m having only affects just one post?

    Thanks for the support!

    Sorry, I meant <script> instead of <style> Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Javascript for auto refreshing one page once’ is closed to new replies.