We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31955
    • 84 Posts
    Maybe it has been discussed already, I searched but didn't find anything:

    Why does the manager use javascript to open links such as "View site" or all the links in the "Support" menu?

    I constantly find myself middle-clicking on them in Firefox (to open in new tab).

    wouldn't a simple

    <a href="http://modx.com/forums" target="_NEW"> 
    suffice instead of
    <a onclick="window.open('http://modx.com/forums');" href="javascript:;">

    ?
      • 31955
      • 84 Posts
      (please note, the forum seems to change some of the html above. all I want to know is: why window.open instead of a regular link?
      • I don't have an answer for you, but I have also found this annoying at times. You many want to file this in the tracker (tracker.modx.com) so it get's included in a future release, or if they decline it, they will give a reason why.
          Patrick | Server Wrangler
          About Me: Website | TweetsMODX Hosting
          • 31955
          • 84 Posts
            • 32316
            • 387 Posts
            whistlemaker Reply #5, 12 years ago
            Why?
            Perhaps because javascript is useful for some of the links (see below for an example) and it easier to make them all the same way (i.e. with a template)

            for example this menu item link:
            <li>
            <a href="javascript:;" onclick="
            MODx.msg.confirm({
                title: _('remove_locks')
                ,text: _('confirm_remove_locks')
                ,url: MODx.config.connectors_url+'system/remove_locks.php'
                ,params: {
                    action: 'remove'
                }
                ,listeners: {
                    'success': {fn:function() { Ext.getCmp('modx-resource-tree').refresh(); },scope:this}
                }
            });">Remove Locks<span class="description">This will remove any locks that are on any manager pages as a result of other users editing them.</span>
            </a>
            </li>
              • 31955
              • 84 Posts
              Quote from: whistlemaker at May 03, 2012, 07:21 PM
              easier to make them all the same way (i.e. with a template)

              if you browse through the menu items you will notice that most of the links do not use javascript. When all a link does is call "window.open" on "onclick", the most basic function of the anchortag should be used instead.
                • 32316
                • 387 Posts
                whistlemaker Reply #7, 12 years ago
                When all a link does is call "window.open" on "onclick", the most basic function of the anchortag should be used instead.
                Totally agree.

                I was just trying to figure out the why - I started at the left Site menu and looked at the code and all I saw were href="javascript:;" - I guess I missed expanding the Dashboard menu and was too lazy to continue and check every menu