javascript - Add a query string to anchor link from query embedded in current URL -
how dynamically add "?q='query'" (where 'query' query string search box , embedded in the current page url example.com/search/?='query') anchor link on page?
an example of can found on website: https://www.ecosia.org/search?q=test
here page include links '?q=test' query added them (e.g. https://www.ecosia.org/images?q=test)
thank help
this append querystring page url onto every link on page.
var qs =window.location.search; $('a').each(function(){ var href = $(this).attr('href') $(this).attr('href',href+qs) })
Comments
Post a Comment