Redirecting to a URL and breaking the frameset
Hello, Is there a convenient recipe for redirecting to a URL and breaking the frameset? I have been trying to use trans.response.send_redirect with a variety of URLs, either something as simple as url_for("/") or as complicated as a url_for invocation with lots of arguments, but the resulting content produced for the centre frame is always confined to the centre frame and always includes the top navigation bar. I suppose an alternative query would concern whether it is possible to disable the navigation bar when redirecting within the centre frame, but I actually want to update the user information in the navigation bar. Paul
Adding the attribute target="_top" to your URL will load the URL in the main browser window rather than a frame. E.g. <a href="controller/action" target="_top">Load result in top window</a> Best, J. On Jan 21, 2013, at 7:24 AM, Paul Boddie wrote:
Hello,
Is there a convenient recipe for redirecting to a URL and breaking the frameset? I have been trying to use trans.response.send_redirect with a variety of URLs, either something as simple as url_for("/") or as complicated as a url_for invocation with lots of arguments, but the resulting content produced for the centre frame is always confined to the centre frame and always includes the top navigation bar.
I suppose an alternative query would concern whether it is possible to disable the navigation bar when redirecting within the centre frame, but I actually want to update the user information in the navigation bar.
Paul ___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at:
On 21/01/13 15:16, Jeremy Goecks wrote:
Adding the attribute
target="_top"
to your URL will load the URL in the main browser window rather than a frame. E.g.
<a href="controller/action" target="_top">Load result in top window</a>
But in the Python code itself? I'm writing an action in the user controller that should redirect to the main page after interacting with the user in the centre frame, and although I can see some JavaScript magic in various template files, along with a refresh_frames parameter, I can't get either trans.response.send_redirect or trans.fill_template to produce something that breaks out of the frameset and refreshes the entire browser window. Paul
On 21/01/13 15:26, Paul Boddie wrote:
On 21/01/13 15:16, Jeremy Goecks wrote:
Adding the attribute
target="_top"
to your URL will load the URL in the main browser window rather than a frame. E.g.
<a href="controller/action" target="_top">Load result in top window</a>
But in the Python code itself? I'm writing an action in the user controller that should redirect to the main page after interacting with the user in the centre frame, and although I can see some JavaScript magic in various template files, along with a refresh_frames parameter, I can't get either trans.response.send_redirect or trans.fill_template to produce something that breaks out of the frameset and refreshes the entire browser window.
Following up to myself with one solution that seemed to work: I defined a template that inherits from "base.mako" and which writes a message for browsers without JavaScript enabled, telling the user to follow a link to the main page in the way suggested above. But in the page's JavaScript I put the following: window.top.location.href = '${h.url_for( "/" )}'; Naturally, the value is translated to the root URL of the application. It feels like a nasty hack, but I suppose that any application using frames is more or less obliged to deploy JavaScript "redirects" of this nature for such operations. Paul
On 21/01/13 15:26, Paul Boddie wrote:
On 21/01/13 15:16, Jeremy Goecks wrote:
Adding the attribute
target="_top"
to your URL will load the URL in the main browser window rather than a frame. E.g.
<a href="controller/action" target="_top">Load result in top window</a>
But in the Python code itself? I'm writing an action in the user controller that should redirect to the main page after interacting with the user in the centre frame, and although I can see some JavaScript magic in various template files, along with a refresh_frames parameter, I can't get either trans.response.send_redirect or trans.fill_template to produce something that breaks out of the frameset and refreshes the entire browser window.
Following up to myself with one solution that seemed to work: I defined a template that inherits from "base.mako" and which writes a message for browsers without JavaScript enabled, telling the user to follow a link to the main page in the way suggested above. But in the page's JavaScript I put the following:
window.top.location.href = '${h.url_for( "/" )}';
Sure, this will accomplish what you want from the server side. You could generalize this approach with an option that resembles refresh_frames if you wanted.
It feels like a nasty hack, but I suppose that any application using frames is more or less obliged to deploy JavaScript "redirects" of this nature for such operations.
We're slowly transitioning Galaxy to be a single-page, HTML5/JavaScript driven Web application so that we can provide more flexibility and power in the UI like what you're after here. Best, J.
participants (2)
-
Jeremy Goecks
-
Paul Boddie