hypra

SEC-003: URL that runs code

Error: the page doesn't build until this is fixed.

javascript:, vbscript: and data:text/html URLs run code when they're opened, instead of opening a page. They're a common way to slip scripts into a page, so Hypra doesn't write them.

Fails

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  a("javascript:openCart()") "Cart"
}
error[SEC-003]: this URL runs code instead of opening a page
 --> page.hypra:3:5
  |
3 |   a("javascript:openCart()") "Cart"
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  = help: javascript:, vbscript: and data:text/html URLs aren't allowed; use a script or an action
  = docs: https://hypralang.dev/rules/sec-003/

1 error, 0 warnings

Fixed

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  a("/cart") "Cart"
  button(type: "button", "@click": "openCart()") "Quick view of the cart"
}