JavaScript encodes encode to the url url

  • 2020-05-16 06:23:17
  • OfStack

This article illustrates an example of how JavaScript encodes encode for url web addresses. Share with you for your reference. The specific analysis is as follows:

JavaScript encodes encode for url website, and encodeURIComponent can be used


var myUrl = 'http://www.baidu.com';
var myOtherUrl =
  "//www.ofstack.com/index.html?url="+encodeURIComponent(myUrl);

I hope this article is helpful to you in javascript programming.


Related articles: