My website URL is:- http://16005ee.blogspot.in/2017/10/urlnametest.html?n=user.name
So I want to extract that user name from URL into html but I can't get it
I actually had tried it already but it is not working
Please help me
Html code
<P id="demo"><p>
Script code:-
<script>
document.getElementById("demo").innerHTML =
"Welcome " + editors + " to my website";
function() {
var url_string = window.location.href;
var url = new URL(url_string);
var editors = url.n.get('editors');
console.log (editors);
}
</script>
Based on fact that this is GET parameter you can do it like that:
Where in your case your searchParams is n.
After you get this element you can easily append your html code.
EDIT I've added example with appending html element.
I know that I am late, but from Czeran's answer, I created this JS function that will append and go to the URL:
This allows for a more dynamic URL append
Hope this helps!