By liegebuggy on
Hi,
within the navigation menu i have a link to an external website and wonder if there is a way to change the target of a link?
< href=... target="new_window">...
Any ideas?
Hi,
within the navigation menu i have a link to an external website and wonder if there is a way to change the target of a link?
< href=... target="new_window">...
Any ideas?
Comments
=-=
investigate the ext_link.module
hi, i tried the external
thx, it works with the default theme.
but when using it within my own theme (out of the admin area) it does not show an icon and does not add an target :-(
how to repair this?
=-=
I imagine it doesn't work in your theme because you may not be printing the
<$scripts>or<$closure>variables in your page.tpl.php file? compare with a core theme and ensure you are using all variables required.javascript might help
go to theme folder and add the following javascript to page.tpl.php file before tag
them go the menu and add #newpagemenu to each item that you want to be open in new target, I had test it and it should work
wow
You don't know how long I was looking for a solution to this. Thanks it works for me.
The only thing is, what if I want to open to a target iframe instead of a blank new window?
Thanks!
sorry for my late response
check this link, it should help you to modify the window.open attributes
http://msdn.microsoft.com/en-us/library/ms536651(VS.85).aspx
Nice
This script works like a charm for the menus, as well as for another problem I had with a javascript module generating links that I wanted to open in a new page but would not carry over the target=_blank. Thanks for this!
Jquery version
blade_rsw2003, thanks for this solution! I loved the approach, but kept getting a javascript error (this.href is null). Not knowing any javascript myself, I had a colleague take a look for me, who rewrote as a jquery function. Below is the script we ended up with. Note that we are using a class of "popmeup" instead (using the module Menu Attributes to set the class), and we added some extra attributes for setting the window size (note that I don't normally condone that kind of thing, but in this case, it was the appropriate solution).
<script>window.onload =
This variation of your code above will negate the need for a #tag and will simply detect links that start with http://www. to be dictated to open in a new window. I prefer this because the #tag transfers to the new window in the URL bar which is unsightly.
Thanks for the code though, works awesome!
you welcome
;-)