Skip to content

Instantly share code, notes, and snippets.

View nomad411's full-sized avatar
🎓
Living la vida mocha!

Gérard Godin nomad411

🎓
Living la vida mocha!
  • GetGo Internet Coaching
View GitHub Profile
@nomad411
nomad411 / replace_text_with_url_param.js
Created April 11, 2022 14:22 — forked from cgilchrist/replace_text_with_url_param.js
Replace some text on your page with the value of a URL parameter
<script type="text/javascript">
var getUrlParams = function() {
var params = {}, hash;
var hashes = decodeURI(window.location.href).replace(/\+/g," ").slice(window.location.href.indexOf('?') + 1).split('&');
for (var i=0; i<hashes.length; i++) {
hash = hashes[i].split('=');
params[hash[0]] = hash[1];
}
return params;
};