Forum Discussion

Noora's avatar
Noora
Advisor
10 years ago

Q&A ActiveCast to open to a new window

Is there a way to get ActiveCast Q&A element to open links to a new window/tab like a target="_blank"?

<script type="text/javascript" id="lia-product-qanda-null" src="https://yhteiso.elisa.fi/t5/qanda/productactivecastpage/node-display-id/category%3AElisa/num-search-results/5/num-resolved-questions/5?profile.language=fi"></script>
  • PaoloT's avatar
    PaoloT
    Lithium Alumni (Retired)

    Hi Noora

     

    the activecast code ultimately runs in the browser and generates HTML injected in the page. It should be possible to create additional Javascript code that fires once the Activecast code has completed, and modifies the resulting HTML to achieve your desired behavior.

     

    What I would also suggest is to look at the SEO enhanced Ratings & Reviews  as an alternative integration model. It could be by following this method the above change becomes easier (along with the other benefit of the SEO friendly approach available since 14.11)

     

    Hope this helps!

  • Maybe you could try using jQuery. Maybe something like this (didn't test it):

     

    <@liaAddScript>
      (function($) {
        $(document).ready(function() {
          $( "[your_container_selector]" ).on( "click", "[your_link_selector]", function() {
              e.preventDefault(); 
              var url = $(this).attr('href'); 
              window.open(url, '_blank');
          });
        });
      })(LITHIUM.jQuery);
    </@liaAddScript>

    I think you'll have to use delegated events cause some of the links are generated later on (e.g. the suggestions when tipping).

     

    Hope this helps yot further.

     

    Best,

    Nikolay