Yngvarr

Generation

generate functionSat, 11 Feb 2023

get location url

function getUrl(key) { let url = window.location.href let urlList = url.split('?')[1].split('&') for (let i in urlList) { if (urlList[i].split('=')[0] === key) { return urlList[i].split('=')[1] } } return undefined }

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant