Form EmbeddingNext.jsApp Router
Step 3: Optimize
Optimize Surface Form loading speed
- Navigate to the
app/layout.tsxfile. - Add the following
<link>tags in the Start of<head>tag section.
<!-- Speed up connections to forms.withsurface.com by performing early DNS resolution and TCP handshake -->
<link rel="dns-prefetch" href="https://forms.withsurface.com">
<link rel="preconnect" href="https://forms.withsurface.com" crossorigin="">
<!-- Fetch the form in advance, so it's ready when a user opens it. -->
<link rel="prefetch" href="REPLACE ME WITH FORM URL" as="document">Replace REPLACE ME WITH FORM URL with a Surface Form URL.