Get started with purl CDN

MIT licensed

Purl: library for history management, deep linking in SPA.

Tags:
  • url
  • parser

Stable version

Copied!

How to start using purl CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with purl CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/purl/2.3.1/purl.min.js"></script>
</head>
<body>
    <button id="generate">Generate PURL</button>
    <script>
        document.addEventListener('DOMContentLoaded', () => {
            const generateButton = document.getElementById('generate');
            const purl = new PURL();

            generateButton.addEventListener('click', () => {
                const baseUrl = 'https://example.com';
                const params = {
                    id: '123',
                    name: 'John Doe'
                };

                const purlString = purl.set(baseUrl).query(params).toString();
                console.log(purlString);
            });
        });
    </script>
</body>
</html>
Copied!
Copied!

All versions