L
L
lavrik_andrey2019-10-04 10:12:48
JavaScript
lavrik_andrey, 2019-10-04 10:12:48

How to get the value of a parameter from the URL of an AMP page?

You need to get the parameters from the page url and use them on the page itself (substitute them in the href)
For example
https://www.site.ru/index.html?someparam=test123
There are links on the page

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex-1917, 2019-10-04
@alex-1917

function getU(){var u=window.location.search,a=[],v=[],r=[];a=(u.substr(1)).split('&');if(a[0]=="")return!1;for(i=0;i<a.length;i ++){v=a[i].split('=');r[v[0]]=v[1]}
return r}
var res= getU();
alert(res['someparam']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question