admin管理员组

文章数量:1126302

Yesterday I learned about the prerender function in html. I was glad that such a thing exists, because in my current project a couple of pages do not load fast enough. But I ran into a problem. My project is written in spring boot using thymeleaf and I have dynamic links that open pages by id:

<a th:href=“@{/form/edit/{id}(id=${id_back})}”><button>previous</button></a>
<a th:href=“@{/form/edit/{id}(id=${id_next})}”><button>next</button></a>

Do you know a way to put this same function inside a pre-render script?

Maybe it's possible to do it somehow like this?

<script type="speculationrules">
  {
    "prerender": [
      {
        "urls": [th:href=“@{/form/edit/{id}(id=${id_back})}”, th:href=“@{/form/edit/{id}(id=${id_next})}”]
      }
    ]
  }
</script>

Here is documentation about this feature:

本文标签: javascriptPrerendering dynamic links using htmlStack Overflow