Yep, Jon is right. Just open the link in a new window using target=_blank or some other method and it will redirect in the new window to the correct location.
Thanks for the quick reply, it is very much appreciated.
The problem is, that the link is in a submenu created based upon the page-structure in the content area. So i don't have much control on the single anchor-tag. The link that needs to be opened in a new window is just one among other internal links in the submenu.
So when i create a new page in the content area and i choose the PWRedirectPage document type, i only get to choose from the internal pages or external URL. It would be at that point i would be cool to have the option to choose between _blank, _new, _self and so on - or even a cusom target like a iframe.
Hope it makes sense and sorry for not explaining the problem good enough in the first post :)
You could add a series of true/false checkboxes to the PWRedirectPage DocType and then react accordingly in the Navigation building macro. Would that work? I've done that before on other projects. Like a "isNewWindow" or something. Then in the Nav code check if isNewWindow is true and add target=_blank to the <a> as an attribute.
The redirect is a simple user control that can't really control the browser behavior regarding new window, etc. All the redirection is done server-side.
Checkbox could work, but perhaps a new dropdown datatype where you can choose your target options might be easier. In razor it would look something like this:
I have the permanent redirection working as expected but i would rather have the same opened in a new window. I tried to add the target="_blank" but doesnt work. Is there something am missing here?
The trick here is that the Umbraco macro cannot have the target="_blank" on it as that is a very specific tag for Umbraco. The target="_blank" needs to go on the <a> tag that is referencing the redirect page via the content picker. For example
Make sense but here lets say the user click on a link from the homepage itself and if ever he type the url in address bar of his browser he will automatically be redirected to the Url specified.
It is in fact working as expected but should be able to open in another window. From the example you mentioned earlier i therefore will need to add True/False boolean for that node and if Yes = _blank in the url?
Since the redirect is happening server-side (via ASP.NET) and the popup behavior happens on the front-end in the browser, its actually impossible for the package to popup a window directly. At least as its currently designed.
Yes, you could change the DocType to have a true/false and then check that and if it is set to true then add target="_blank" in your markup. Treat it the same as any other content page. How would you open a normal content page in a new window conditionally?
Yes i got it working....i added a docType True/False and depending on how the admin wants to open the url it will treat it as either as a new window or self.
In any case if the user type the complete url of the page he will automatically be redirected to the url added, but if however he clicks on the link from the homepage itself then a new window will be open.
Open URL in new window
Hi
Great script!
But is it possible to launch an URL(external) in a new window?`
Thanks
If you are using an anchor (<a>) tag you need to add a 'target' attribute e.g.
See: http://www.w3schools.com/tags/att_a_target.asp
Yep, Jon is right. Just open the link in a new window using target=_blank or some other method and it will redirect in the new window to the correct location.
Thanks,
Jason
Thanks for the quick reply, it is very much appreciated.
The problem is, that the link is in a submenu created based upon the page-structure in the content area. So i don't have much control on the single anchor-tag. The link that needs to be opened in a new window is just one among other internal links in the submenu.
So when i create a new page in the content area and i choose the PWRedirectPage document type, i only get to choose from the internal pages or external URL. It would be at that point i would be cool to have the option to choose between _blank, _new, _self and so on - or even a cusom target like a iframe.
Hope it makes sense and sorry for not explaining the problem good enough in the first post :)
You could add a series of true/false checkboxes to the PWRedirectPage DocType and then react accordingly in the Navigation building macro. Would that work? I've done that before on other projects. Like a "isNewWindow" or something. Then in the Nav code check if isNewWindow is true and add target=_blank to the <a> as an attribute.
The redirect is a simple user control that can't really control the browser behavior regarding new window, etc. All the redirection is done server-side.
Thanks,
Jason
Checkbox could work, but perhaps a new dropdown datatype where you can choose your target options might be easier. In razor it would look something like this:
Jeroen
Thanks guys, i will look into your suggestions and post if something works :)
Hi Guys,
I have the permanent redirection working as expected but i would rather have the same opened in a new window. I tried to add the target="_blank" but doesnt work. Is there something am missing here?
The trick here is that the Umbraco macro cannot have the target="_blank" on it as that is a very specific tag for Umbraco. The target="_blank" needs to go on the <a> tag that is referencing the redirect page via the content picker. For example
Does that make sense?
Thanks,
Jason
Hi Jason,
Make sense but here lets say the user click on a link from the homepage itself and if ever he type the url in address bar of his browser he will automatically be redirected to the Url specified.
It is in fact working as expected but should be able to open in another window. From the example you mentioned earlier i therefore will need to add True/False boolean for that node and if Yes = _blank in the url?
Hi Fuji,
Since the redirect is happening server-side (via ASP.NET) and the popup behavior happens on the front-end in the browser, its actually impossible for the package to popup a window directly. At least as its currently designed.
Yes, you could change the DocType to have a true/false and then check that and if it is set to true then add target="_blank" in your markup. Treat it the same as any other content page. How would you open a normal content page in a new window conditionally?
Thanks,
Jason
Yes i got it working....i added a docType True/False and depending on how the admin wants to open the url it will treat it as either as a new window or self.
In any case if the user type the complete url of the page he will automatically be redirected to the url added, but if however he clicks on the link from the homepage itself then a new window will be open.
Something like
Thanks for your help.
//fuji
Awesome! Glad you could get it working. Happy to help.
is working on a reply...