• Resolved inTOWN

    (@intown)


    Hi there,

    Somehow the swiftype plugin is conflicting with some of my code:
    The button to external links in the search page have a target=”_blank” but with swiftype installed it opens the link within the same window.
    Can anybody tell me which code of swiftype is causing this?

    http://wordpress.org/plugins/swiftype-search/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter inTOWN

    (@intown)

    For now I’ve removed this code from install_swiftype.min.js :

    $(".swiftype-result a").click(function(event) {
          var $element = $(this);
          var docId = getDocumentId($element.parents(".swiftype-result").attr("class"));
    
          if (docId !== null) {
            event.preventDefault();
    
            var theWindow = window;
            if (event.metaKey || event.ctrlKey) {
              theWindow = window.open('about:blank', '_blank');
            }
    
            Swiftype.pingSearchResultClick(Swiftype.engineKey, docId, getSearchQuery(), function() {
              theWindow.location = $element.attr("href");
            });
          }
        });

    Which seems to do the trick, but of course a temporary solution….

    Plugin Author qhoxie

    (@qhoxie)

    I think for now removing that is the best approach. The issue is that we need to manage clicks on search results in order to track analytics for you. By removing this, your new window plugin will work, but it will not track clickthroughs in your Swiftype analytics.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘target ="blank"’ is closed to new replies.