Search code examples
javascripthtmlcsspolymer

Opening link in new tab from Polymer Modal


Hi just a very simple question. I have a Modal in my Polymer 3 page. I want to add a link in the model and open the link in new Tab, but its not working. The link opens in the same window, where the popup is opened?

<html>
  <div class="modal--innerContainer">
     <div>
        <h3>${item.title}</h3>
        <p>${item.content}</p>
        <a href="#" target="_blank">Read more</a>
     </div>
     <button on-click="${() => this._closeModal()}">Close</button>
  </div>
</html>


Solution

  • Please try this

    <html>
    <div class="modal--innerContainer">
        <div>
            <h3>${item.title}</h3>
            <p>${item.content}</p>
            <a target="_blank" rel="noopener noreferrer" href="http://www.google.com">Read More</a>
    
        </div>
        <button on-click="${() => this._closeModal()}">Close</button>
    </div>
    
    </html>