page1.html 742 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page 1</title>
<p>The <code>next</code> query param must be the URL for the next page to
link to.
<script>
  var match = document.location.search.match(/next=(.*)/);
  if (match && match.length == 2) {
    var next = decodeURIComponent(match[1]);
    var link = document.createElement('a');
    link.innerText = 'Next!';
    link.textContent = 'Next!';
    link.id = 'next';
    link.href = next + '?next=' + encodeURIComponent(
        'http://' + document.location.host +
        document.location.pathname.replace('page1.html', 'page3.html'));
    document.body.appendChild(link);
  }
</script>