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

  • SEARCH
  • Home
  • 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 7721193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:51:44+00:00 2026-06-01T03:51:44+00:00

In my Rails 3.2.3 application I have the following code in the application.html.erb to

  • 0

In my Rails 3.2.3 application I have the following code in the application.html.erb to refresh the whole page every 30 seconds:

<meta http-equiv="refresh" content="30">

It works well (it’s an internal intranet and we need to make sure everyone is looking at the latest information regardless of how long they have left the page open on their computer) and anything more complex, such as AJAX, feel unnecessary.

What I would like to do is have some kind of ‘unless’ statement wrapping the meta tag such as:

<% unless page.contains('input') %>
    <meta http-equiv="refresh" content="30">
<% end %>

This would prevent the page refreshing after 30 seconds if the page contains a form input field. As it stands at the moment the page will refresh even if you’re halfway through filling in a page.

Is anything like this possible. I realise the above code example would never work, it’s purely to explain what I’m trying to achieve.

One possibility is to check what the current page’s action is as stated in the documentation:

<% current_page?(:action => 'new') %>

but I’m not entirely sure if that would work.

  • 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-01T03:51:45+00:00Added an answer on June 1, 2026 at 3:51 am

    I would probably handle this with a script instead, and remove the <meta http-equiv='refresh'> tag.

    var reloadTime = 30;
    body.onload = function() {
      // Reload after 30s if no input tags are found
      if (document.getElementsByTagName("input").length === 0) {
        setTimeout(function() {window.location.reload(true);}, reloadTime);
      }
    };
    

    If you’re using jQuery or another library, append this to the DOM ready functions as in:

    $(document).ready(function() {
       var reloadTime = 30;
       if ($("input").length === 0) {
          setTimeout(function() {window.location.reload(true);}, reloadTime);
       }  
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a Rails application using prototype, I have the following (simplified) code in my
I have the following code in my Rails 3 application. @clinical_healthplan_spend = Clinical.select(ClientKey as
I have the following code in one of my controllers (in a Rails 3.1
I have the following code, thanks to another SO question/answer: page = agent.page.search(table tbody
I am using the following gem in my rails application: http://github.com/fnando/post_commit I am trying
Im using the following guide for getting started with rails for ubuntu 9.10. http://guides.rails.info/getting_started.html
I have an rails a application whereby it has a page that contains a
I have recently created a new rails 3 application, using the code that I
I'm working on a Rails application where I have some a set of two
I am using haml with my rails application and i have a question how

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.