URL in Navbar to open new tab

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BattleMetalChris
    Member
    • Mar 2021
    • 50

    URL in Navbar to open new tab

    I can easily add a URL to the Navbar from the Administration->User Interface screen, but is there any way to make it target="_blank" so that the URL opens in a new tab?

    thanks
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Maybe revise the need of opening in a new tab. Espo won't allow leaving the page if the form is edited but not saved. Not losing entered data is one of the main reason why this feature is used. Forcing opening links in a new tab in most cases is a bad practice. Though many old school developers like to use it. Better to let a user to decide how they want the link to be opened.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment


    • yuri
      yuri commented
      Editing a comment
      Anchor links1 may have a target attribute which controls what happens when that link is clicked. One of the possible values of that attribute is _blank, which

    • BattleMetalChris
      BattleMetalChris commented
      Editing a comment
      The Good Reason in this case is the link opens our Zendesk support site, rather than something within Espo, so they'll usually need to use it whilst also keeping whatever they were working on.

      The way I've solved it was to Extend navbar.js and use the afterRender event to add the target attribute.
      Last edited by BattleMetalChris; 04-10-2024, 12:06 PM.

    • shalmaxb
      shalmaxb commented
      Editing a comment
      BattleMetalChris, it is always nice practice to reveal, how you coded to resolve. Thank you.
  • lj4353
    Senior Member
    • Nov 2023
    • 114

    #3
    @BattleMetalChris
    I encountered the same issue. Based on your suggestion, I added the following code to the afterRender event in navbar.js, but it is not working.

    client/src/views/site/navbar.js
    Click image for larger version

Name:	image.png
Views:	129
Size:	102.5 KB
ID:	108080

    Comment


    • Kharg
      Kharg commented
      Editing a comment
      I developed an extension for this. i may share it if I find the time

    • lj4353
      lj4353 commented
      Editing a comment
      @Kharg
      Thank you, I need this extension. How can I get it?
Working...