How to put the url of the current page in a javascript variable in blogger

Asked

Viewed 48 times

-2

I know in the blogger the excerpt <a expr:href='data:post.url'>TEXTO</a> means that the text will always have the link of the current page open, regardless of which page is.

You can get the url of data:post.url and put into a javascript variable?

For example:

<script>
  var url = data:post.url;
</script>

That way above doesn’t work.

  • To do this just use var url = location.href;

1 answer

0

The Javascript url is taken from location

var url = location.href;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.