Refresh automatically

Hi everybody!!!
I´m doing a webpage, I want that this webpage refreshly automatically.
How can I do that with Ror

Thanks!!!

Robert W. wrote:

Guille S. wrote:

Hi everybody!!!
I´m doing a webpage, I want that this webpage refreshly automatically.
How can I do that with Ror

Most people use Prototype or jQuery for this:

Then they are probably foolish. You can use a meta tag refresh for
this. No JavaScript needed.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Robert W. wrote:

Guille S. wrote:

Hi everybody!!!
I´m doing a webpage, I want that this webpage refreshly automatically.
How can I do that with Ror

Most people use Prototype or jQuery for this:

http://api.prototypejs.org/ajax/ajax/periodicalupdater.html

I’m sure there is also a Rails helper method wrapping this as well.
Don’t remember what it is off-hand, but you can look that up in the
Rails docs.

Where I have to write the Ajax code???

Marnen Laibow-Koser wrote:

Robert W. wrote:

Guille S. wrote:

Hi everybody!!!
I´m doing a webpage, I want that this webpage refreshly automatically.
How can I do that with Ror

Most people use Prototype or jQuery for this:

Then they are probably foolish. You can use a meta tag refresh for
this. No JavaScript needed.

Yes, but who refreshes an entire page these days?

Guille S. wrote:

Hi everybody!!!
I´m doing a webpage, I want that this webpage refreshly automatically.
How can I do that with Ror

Most people use Prototype or jQuery for this:

http://api.prototypejs.org/ajax/ajax/periodicalupdater.html

I’m sure there is also a Rails helper method wrapping this as well.
Don’t remember what it is off-hand, but you can look that up in the
Rails docs.

Robert W. wrote:

Marnen Laibow-Koser wrote:

Robert W. wrote:

Guille S. wrote:

Hi everybody!!!
I´m doing a webpage, I want that this webpage refreshly automatically.
How can I do that with Ror

Most people use Prototype or jQuery for this:

Then they are probably foolish. You can use a meta tag refresh for
this. No JavaScript needed.

Yes, but who refreshes an entire page these days?

Okay, many sites, do. But, is that necessary in many of those cases?
It’s more likely that a small bit of HTML needs to be added to the DOM.

Is there a particular reason you you can’t use the meta refresh tag?

Marnen Laibow-Koser wrote:

Robert W. wrote:

Robert W. wrote:
Okay, many sites, do. But, is that necessary in many of those cases?
It’s more likely that a small bit of HTML needs to be added to the DOM.

True, perhaps. But the OP didn’t say that that was the case…

So you mean to say, “Turn off my brain and answer the exact question
asked?” Even if that direct answer can lead to a bad user experience.

I hate when I’m reading something on a web page, it refreshes and then
have to go back and figure out where I left off. This is why I didn’t
mention the meta refresh method. I’m fully aware of it, but I avoid it
like I would the plague.

Robert W. wrote:

Robert W. wrote:

Marnen Laibow-Koser wrote:

Robert W. wrote:

Guille S. wrote:

Hi everybody!!!
I´m doing a webpage, I want that this webpage refreshly automatically.
How can I do that with Ror

Most people use Prototype or jQuery for this:

Then they are probably foolish. You can use a meta tag refresh for
this. No JavaScript needed.

Yes, but who refreshes an entire page these days?

Okay, many sites, do. But, is that necessary in many of those cases?
It’s more likely that a small bit of HTML needs to be added to the DOM.

True, perhaps. But the OP didn’t say that that was the case…

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Robert W. wrote:

Marnen Laibow-Koser wrote:

Robert W. wrote:

Robert W. wrote:
Okay, many sites, do. But, is that necessary in many of those cases?
It’s more likely that a small bit of HTML needs to be added to the DOM.

True, perhaps. But the OP didn’t say that that was the case…

So you mean to say, “Turn off my brain and answer the exact question
asked?” Even if that direct answer can lead to a bad user experience.

No, I just mean that we don’t really know what the use case is.

I hate when I’m reading something on a web page, it refreshes and then
have to go back and figure out where I left off.

That would be annoying indeed.

This is why I didn’t
mention the meta refresh method. I’m fully aware of it, but I avoid it
like I would the plague.

Whereas I’d use it in preference to the JS, because it’s more reliably
guaranteed to work.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

Whereas I’d use it in preference to the JS, because it’s more reliably
guaranteed to work.

I’ve given up the battle to make everything work without JavaScript.
JavaScript is most certainly winning this fight. Hardly anyone disables
it anymore so I think it safe enough to be relying on it. For those few
holdouts that are disabling it, the refresh feature won’t work so they
have to reload the page themselves. That still beats refreshing the
entire page with no option to disable that “feature.”

Robert W. wrote:

Marnen Laibow-Koser wrote:

Whereas I’d use it in preference to the JS, because it’s more reliably
guaranteed to work.

I’ve given up the battle to make everything work without JavaScript.

I have not and will not, except in isolated circumstances.

JavaScript is most certainly winning this fight.

It’s not an issue of winning. I’m perfectly happy to use JS where it’s
necessary (with appropriate degradation), but I think it is silly, in
most cases, to use it to duplicate HTML features.

Hardly anyone disables
it anymore so I think it safe enough to be relying on it.

Now that’s just not true at all. If nothing else, lots of mobile
browsers have deficient or nonexistent JS implementation – even on
smartphones like the BlackBerry Curve. (I speak from experience.)

For those few
holdouts that are disabling it, the refresh feature won’t work so they
have to reload the page themselves. That still beats refreshing the
entire page with no option to disable that “feature.”

Depends on the use case. And you could use an iframe to do something
similar without JS, though that has its own compatibility issues.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Marnen Laibow-Koser wrote:

Robert W. wrote:

Marnen Laibow-Koser wrote:

Whereas I’d use it in preference to the JS, because it’s more reliably
guaranteed to work.

I’ve given up the battle to make everything work without JavaScript.

I have not and will not, except in isolated circumstances.

Good for you. I commend you on your efforts.

JavaScript is most certainly winning this fight.

It’s not an issue of winning. I’m perfectly happy to use JS where it’s
necessary (with appropriate degradation), but I think it is silly, in
most cases, to use it to duplicate HTML features.

Hardly anyone disables
it anymore so I think it safe enough to be relying on it.

Now that’s just not true at all. If nothing else, lots of mobile
browsers have deficient or nonexistent JS implementation – even on
smartphones like the BlackBerry Curve. (I speak from experience.)

Such dumb devices would likely need their own dumbed down page anyway. I
won’t base my pages targeted for “real” browsers based on dumb mobile
devices.

For those few
holdouts that are disabling it, the refresh feature won’t work so they
have to reload the page themselves. That still beats refreshing the
entire page with no option to disable that “feature.”

Depends on the use case. And you could use an iframe to do something
similar without JS, though that has its own compatibility issues.

True enough. However, I don’t like iframes much better than the meta
refresh.

Hi
Thanks a lot to the all people who answered the topic.
I wanna to refresh only parts of the webpage, but at the moment I think
that I´m so newbie for refresh only parts of the web.
When I achieve refresh all the web, I´m going to started with the
refresh of the parts I want to refresh.

If anyone can give me some advices, I will be very grateful.

Thanks

Guille S. wrote:

Hi
Thanks a lot to the all people who answered the topic.
I wanna to refresh only parts of the webpage, but at the moment I think
that I´m so newbie for refresh only parts of the web.
When I achieve refresh all the web, I´m going to started with the
refresh of the parts I want to refresh.

It’s really not nearly as hard as you might be thinking:

Call get_averages and put its results in ‘avg’ every 10 seconds

Generates:

new PeriodicalExecuter(function() {new Ajax.Updater(‘avg’,

‘/grades/get_averages’,

{asynchronous:true, evalScripts:true})}, 10)

periodically_call_remote(:url => { :action => ‘get_averages’ }, :update
=> ‘avg’)

‘get_averages’ would be your controller action that would return the
partial HTML that updates the contents of

every
10 seconds (by default).

There are also options for inserting before or after depending on what
you need.

Robert W. wrote:
[…]

Now that’s just not true at all. If nothing else, lots of mobile
browsers have deficient or nonexistent JS implementation – even on
smartphones like the BlackBerry Curve. (I speak from experience.)

Such dumb devices would likely need their own dumbed down page anyway. I
won’t base my pages targeted for “real” browsers based on dumb mobile
devices.

That’s sort of my point – the BB Curve is not a dumb device. It has
a Web browser that does a decent job with most HTML, and is definitely
not targeted at mobile lo-fi sites. So when a device like this has
minimal JS, I believe that means that JS does not have the penetration
that you seem to think it does.
(And 99% of lo-fi mobile sites aren’t worth using anyway.)

For those few
holdouts that are disabling it, the refresh feature won’t work so they
have to reload the page themselves. That still beats refreshing the
entire page with no option to disable that “feature.”

Depends on the use case. And you could use an iframe to do something
similar without JS, though that has its own compatibility issues.

True enough. However, I don’t like iframes much better than the meta
refresh.

I think I actually like them less.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Hi everyone!!!
I have some stupid questions.

It’s really not nearly as hard as you might be thinking:

Call get_averages and put its results in ‘avg’ every 10 seconds

get_average is a function that I have to create?? if it isn´t where(in
the controller, in the view…) and how I call it??

Generates:

new PeriodicalExecuter(function() {new Ajax.Updater(‘avg’,

‘/grades/get_averages’,

{asynchronous:true, evalScripts:true})}, 10)

periodically_call_remote(:url => { :action => ‘get_averages’ }, :update
=> ‘avg’)
Where I have to generate that??

Thanks a lot!!!

PD: I know that I´m a little atupid, but it´s the first time when I done
programming, I only know C code and it´s difficult for me adecuate mi
mind.

Thanks