publish-url-params
Version:
Get url params
28 lines (26 loc) • 808 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="../dist/bundle.js"></script>
<script>
(function() {
function print(content) {
var el = document.createElement('div')
el.innerHTML = content;
document.body.appendChild(el)
}
if (!location.search) {
location.href = location.href + '?foo=123&bar'
}
var content = JSON.stringify((urlparams(location.href)), null, 4)
print(content) // { foo: '123', bar: true }
})()
</script>
</body>
</html>