Discussion:
redirect using a new window
leone
2010-11-24 20:06:56 UTC
Permalink
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
Michele Comitini
2010-11-24 20:47:05 UTC
Permalink
do you mean like this?

{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
mdipierro
2010-11-24 22:19:15 UTC
Permalink
or

<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
leone
2010-11-25 13:13:01 UTC
Permalink
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
mdipierro
2010-11-25 15:30:16 UTC
Permalink
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
leone
2010-11-26 17:42:42 UTC
Permalink
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
mr.freeze
2010-11-26 17:46:52 UTC
Permalink
Like so?:
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
mr.freeze
2010-11-26 17:49:39 UTC
Permalink
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
leone
2010-11-26 19:16:05 UTC
Permalink
The first:
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
mr.freeze
2010-11-26 19:32:39 UTC
Permalink
I don't think you would use redirect as you're not redirecting the
page but opening a new one. Something like this maybe?:

controller
----------
def index():
form = SQLFORM(...)
if form.accepts(request.vars,session):
response.new_window = URL(...)
return dict(form=form)

view
----
{{if response.new_window:}}
<script type="text/javascript">
jQuery(document).ready(function() {
window.open({{=response.new_window}});
});
</script>
{{pass}}
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
mr.freeze
2010-11-26 19:43:25 UTC
Permalink
Whoops, forgot the quotes:
window.open('{{=response.new_window}}');
Post by mr.freeze
I don't think you would use redirect as you're not redirecting the
controller
----------
    form = SQLFORM(...)
        response.new_window = URL(...)
    return dict(form=form)
view
----
{{if response.new_window:}}
   <script type="text/javascript">
    jQuery(document).ready(function() {
        window.open({{=response.new_window}});
    });
    </script>
{{pass}}
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
leone
2010-11-26 19:44:35 UTC
Permalink
Thanks.
I understand. I will use javascript with response var.
Post by mr.freeze
I don't think you would use redirect as you're not redirecting the
controller
----------
    form = SQLFORM(...)
        response.new_window = URL(...)
    return dict(form=form)
view
----
{{if response.new_window:}}
   <script type="text/javascript">
    jQuery(document).ready(function() {
        window.open({{=response.new_window}});
    });
    </script>
{{pass}}
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
mr.freeze
2010-11-26 19:52:38 UTC
Permalink
I wouldn't rely on this behavior as almost all browsers will block it
by default. It is acceptable if it is for an intranet app where you
control the environment (i.e. can turn off the pop-up blocker for your
domain through group policy, etc).
Post by leone
Thanks.
I understand. I will use javascript with response var.
Post by mr.freeze
I don't think you would use redirect as you're not redirecting the
controller
----------
    form = SQLFORM(...)
        response.new_window = URL(...)
    return dict(form=form)
view
----
{{if response.new_window:}}
   <script type="text/javascript">
    jQuery(document).ready(function() {
        window.open({{=response.new_window}});
    });
    </script>
{{pass}}
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
Branko Vukelic
2010-11-27 00:38:38 UTC
Permalink
Better solution would be to trigger a dialog after response. That will
work in most browsers in most environments.
Post by mr.freeze
I wouldn't rely on this behavior as almost all browsers will block it
by default. It is acceptable if it is for an intranet app where you
control the environment (i.e. can turn off the pop-up blocker for your
domain through group policy, etc).
Post by leone
Thanks.
I understand. I will use javascript with response var.
Post by mr.freeze
I don't think you would use redirect as you're not redirecting the
controller
----------
    form = SQLFORM(...)
        response.new_window = URL(...)
    return dict(form=form)
view
----
{{if response.new_window:}}
   <script type="text/javascript">
    jQuery(document).ready(function() {
        window.open({{=response.new_window}});
    });
    </script>
{{pass}}
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
--
Branko Vukelić

bg.branko-***@public.gmane.org
studio-cg7AoQfRTpp1t5T1U1wH0QC/***@public.gmane.org

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group
Branko Vukelic
2010-11-27 00:39:09 UTC
Permalink
I meant something like this: http://jqueryui.com/demos/dialog/
Post by Branko Vukelic
Better solution would be to trigger a dialog after response. That will
work in most browsers in most environments.
Post by mr.freeze
I wouldn't rely on this behavior as almost all browsers will block it
by default. It is acceptable if it is for an intranet app where you
control the environment (i.e. can turn off the pop-up blocker for your
domain through group policy, etc).
Post by leone
Thanks.
I understand. I will use javascript with response var.
Post by mr.freeze
I don't think you would use redirect as you're not redirecting the
controller
----------
    form = SQLFORM(...)
        response.new_window = URL(...)
    return dict(form=form)
view
----
{{if response.new_window:}}
   <script type="text/javascript">
    jQuery(document).ready(function() {
        window.open({{=response.new_window}});
    });
    </script>
{{pass}}
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
--
Branko Vukelić
Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny
Gimp Brushmakers Guild
http://bit.ly/gbg-group
--
Branko Vukelić

bg.branko-***@public.gmane.org
studio-cg7AoQfRTpp1t5T1U1wH0QC/***@public.gmane.org

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group
leone
2010-11-27 09:42:11 UTC
Permalink
Hi,
why doesn't run the simplest solution:
response.headers['Window-target']='_blank' (or _top,..or a window-name
of a page)
response.headers['Location']=url
raise HTTP(303,**response.headers)
????
I meant something like this:http://jqueryui.com/demos/dialog/
Post by Branko Vukelic
Better solution would be to trigger a dialog after response. That will
work in most browsers in most environments.
Post by mr.freeze
I wouldn't rely on this behavior as almost all browsers will block it
by default. It is acceptable if it is for an intranet app where you
control the environment (i.e. can turn off the pop-up blocker for your
domain through group policy, etc).
Post by leone
Thanks.
I understand. I will use javascript with response var.
Post by mr.freeze
I don't think you would use redirect as you're not redirecting the
controller
----------
    form = SQLFORM(...)
        response.new_window = URL(...)
    return dict(form=form)
view
----
{{if response.new_window:}}
   <script type="text/javascript">
    jQuery(document).ready(function() {
        window.open({{=response.new_window}});
    });
    </script>
{{pass}}
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
--
Branko Vukelić
Check out my blog:http://www.brankovukelic.com/
Check out my portfolio:http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca:http://identi.ca/foxbunny
Gimp Brushmakers Guild
http://bit.ly/gbg-group
--
Branko Vukelić
Check out my blog:http://www.brankovukelic.com/
Check out my portfolio:http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca:http://identi.ca/foxbunny
Gimp Brushmakers Guildhttp://bit.ly/gbg-group
Michele Comitini
2010-11-28 21:13:23 UTC
Permalink
AFAIK you cannot do it server side, there is no such header in
HTTP/1.1 standard, and a browsers do not support it

Use javascript or try to respond with a document with meta redirect:

<meta http-equiv="refresh" content="1;URL=http://blah.blah" target="_blank" />
Post by leone
Hi,
response.headers['Window-target']='_blank' (or _top,..or a window-name
of a page)
response.headers['Location']=url
raise HTTP(303,**response.headers)
????
I meant something like this:http://jqueryui.com/demos/dialog/
Post by Branko Vukelic
Better solution would be to trigger a dialog after response. That will
work in most browsers in most environments.
Post by mr.freeze
I wouldn't rely on this behavior as almost all browsers will block it
by default. It is acceptable if it is for an intranet app where you
control the environment (i.e. can turn off the pop-up blocker for your
domain through group policy, etc).
Post by leone
Thanks.
I understand. I will use javascript with response var.
Post by mr.freeze
I don't think you would use redirect as you're not redirecting the
controller
----------
    form = SQLFORM(...)
        response.new_window = URL(...)
    return dict(form=form)
view
----
{{if response.new_window:}}
   <script type="text/javascript">
    jQuery(document).ready(function() {
        window.open({{=response.new_window}});
    });
    </script>
{{pass}}
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
--
Branko Vukelić
Check out my blog:http://www.brankovukelic.com/
Check out my portfolio:http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca:http://identi.ca/foxbunny
Gimp Brushmakers Guild
http://bit.ly/gbg-group
--
Branko Vukelić
Check out my blog:http://www.brankovukelic.com/
Check out my portfolio:http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca:http://identi.ca/foxbunny
Gimp Brushmakers Guildhttp://bit.ly/gbg-group
Wikus van de Merwe
2010-11-26 19:40:37 UTC
Permalink
If your talking about the HTTP redirect there is no such mechanism in
it. It's just a simple 303 response which informs your browser to
fetch the content of a page from a different URL. If you want to open
a new panel/window with URL_2 after visiting URL_1 that has to be done
with javascript.

Why do you want to do that anyway? Opening new panel/window is plain
evil (especially if done with javascript). This should be controlled
by the user, not the webapp developer who thinks he knows better what
the users want. Give a normal link and let the users decide how they
want to open it.
mdipierro
2010-11-26 19:41:32 UTC
Permalink
I still do not understand what you want to do. Perhaps you can explain
what problem are you trying to solve.
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
.....but using redirection. There is a way?
Post by mr.freeze
Or do you mean use some javascript in the response to open a new
window?
Post by mr.freeze
A('Open in new window',_href=URL('...'),_target='_blank')
Post by leone
I need to redirect to a new page (for example as a new tab in
chrome....).
Post by mdipierro
I do not understand what you want to do.
Post by leone
Thanks for suggest, but I need something redirect(URL(..),
_target='new').
I fear that it doesn't exists, though web2py does anything.
Post by mdipierro
or
<a href="{{=URL(...)}}" target="new">click me</a>
Post by Michele Comitini
do you mean like this?
{{=A('click me!', _href=URL(...), _target='new')}}
Post by leone
Hi,
there is a way to redirect to a new page simulating <A ....,
target='new'> using URL()
or a controller function???
Thanks
leone
Continue reading on narkive:
Loading...