This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Smoother redirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Smoother redirect" Watch "Smoother redirect" New topic
Author

Smoother redirect

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Ok, this is a "for dummies" question. I'm doing redirect with

<meta http-equiv="REFRESH" content="0;url=/yadda/yadda">

and it works fine, but it's a little unattractive. The original url shows for a fraction of a second and the page refresh is pretty obvious. Is there any smoother way?

I'm doing a Post-Redirect-Get pattern, thinking about doing the Post via AJAX and the redirect via script to just refresh the current URL.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

Are you using JSP/Servlets? I've noticed that initiating the redirect on the server is "smoother" than on the client. Which makes sense I guess. When initiated from the server, the browser recieves a response with no page to be evaluated. Using a page that contains markup and meta tags that require evaluation may be what's causing your blip.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Hmm, I've always done post-redirect-get by sending a redirect page to the browser. Wonder why it never occurred to me to do it at the server. Will give it a try!
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Man, the hoops I hadda jump through to make our front controller do a redirect. It's a major perversion of science, turned a developer hook for streaming output into doing the redirect. Worked great, tho. Thanks again!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

Originally posted by Stan James:
Man, the hoops I hadda jump through to make our front controller do a redirect.
I assume that's a piece of technology you're locked into?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Yes, originally written by the boss so it's pretty firmly in place.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

Originally posted by Stan James:
Yes, originally written by the boss so it's pretty firmly in place.
My condolences.

<mini-rant>How can a front controller that doesn't allow redirects dare call itself a front controller?</mini-rant>
 
GeeCON Prague 2014
 
subject: Smoother redirect