Andrew
Andrew

Reputation: 375

HAML-Coffee Template Links not opening

This is a ridiculous issue, but for some reason, in my Backbone app, external links are being treated as internal ones, simply appended to the url. Here's my .hamlc file snippet:

.row
  %li.modal-annotation-text.marginb-10
    %a{ href: "https://medium.com" } Learn more

When clicking the link, the url changes from http://localhost:3000 to http://localhost:3000/https://medium.com

I can't believe something so simple has caused such headaches.

Upvotes: 0

Views: 31

Answers (1)

Andrew
Andrew

Reputation: 375

Unbelievably, the way I had to solve this was to add an onclick attribute to the link, and removing the href value. Removing the href value had no impact on the functionality, was just so the url bar doesn't reflect the external link when the user returns to the current page.

%li.modal-annotation-text.marginb-10
  %a{ href: "", target: "_blank", onclick: "window.open('https://medium.com/')" }
    Learn more about seasons

I think it is due to the link being in a bootstrap modal. I'm really not a fan of UI tools interfering with basic HTML/DOM simplicity.

Upvotes: 0

Related Questions