Hello
I'm new in Umbraco and just setup a site. I have created a navigation menu using macro partial view. Everything working fine but the links: all the links in the website, navigation links or links inserted in the pages using the editor, are not working if you click on them; if you right click on them and choose 'open in a new window' they work just fine.
Any help?
Thanks
Hi Eliana and welcome to the Umbraco developer forum also known as "Our" in daily speech :)
What does the code you're using for rendering the navigation look like? If you want links to be opened in a new window when clicked you'll need to add the target attribute with a value of "_blank" in them like
<a href="#" target="_blank">Link</a>
But for a navigational purpose that does not seem user friendly to me? If it's a link for an external resource then I think it makes sense :)
Hello Jan
and thanks for your reply
Maybe my explanation wasn't clear :) The navigation menu renders without any problem .. the html is perfect and so are the pages
The problem is when I click on any links (link pointing to pages or mailto links) they don't work .. nothing happens. If I right click on the link and choose open in a new windows the link works ... Seems like the click event on the link is not firing .. I don't get any errors but nothing happens
Ok, that makes things a bit more clear - But weird issue indeed. I'm just wondering whether there is a click event placed in some javascript somewhere, which is set to prevent the default action on links which are not part of the navigation but comes from rich text or something like that maybe?
Do the links work if you disable javascript in the browser - If so then my theory is right :)
I was having the exact same problem, but it is now resolved.
My nav panel links were not working because I had created a link decorator function with e.preventDefault() very early on in the project that I forgot to remove. Of course, neither the console nor anything else indicated any errors! I removed e.preventDefault() and links began working as they should! Thanks!
Anchor links not working
Hello I'm new in Umbraco and just setup a site. I have created a navigation menu using macro partial view. Everything working fine but the links: all the links in the website, navigation links or links inserted in the pages using the editor, are not working if you click on them; if you right click on them and choose 'open in a new window' they work just fine. Any help? Thanks
Hi Eliana and welcome to the Umbraco developer forum also known as "Our" in daily speech :)
What does the code you're using for rendering the navigation look like? If you want links to be opened in a new window when clicked you'll need to add the target attribute with a value of "_blank" in them like
But for a navigational purpose that does not seem user friendly to me? If it's a link for an external resource then I think it makes sense :)
Looking forward to hearing from you.
/Jan
Hello Jan and thanks for your reply Maybe my explanation wasn't clear :) The navigation menu renders without any problem .. the html is perfect and so are the pages The problem is when I click on any links (link pointing to pages or mailto links) they don't work .. nothing happens. If I right click on the link and choose open in a new windows the link works ... Seems like the click event on the link is not firing .. I don't get any errors but nothing happens
Hope this is clear
Hi Eliana
Ok, that makes things a bit more clear - But weird issue indeed. I'm just wondering whether there is a click event placed in some javascript somewhere, which is set to prevent the default action on links which are not part of the navigation but comes from rich text or something like that maybe?
Do the links work if you disable javascript in the browser - If so then my theory is right :)
Cheers, Jan
Hi Jan you are right .. there is a javascript file breaking the hyperlink! Thanks for the tip!
Hi Eliana
Happy I could help you get on the right track :-) It's easy to get confused about these things from time to time,
Happy coding!
/Jan
I was having the exact same problem, but it is now resolved.
My nav panel links were not working because I had created a link decorator function with e.preventDefault() very early on in the project that I forgot to remove. Of course, neither the console nor anything else indicated any errors! I removed e.preventDefault() and links began working as they should! Thanks!
is working on a reply...