Remove plus sign (+) in URL query string

后端 未结 5 1781
失恋的感觉
失恋的感觉 2020-11-29 06:46

I am trying get the string in the following URL to display on my webpage.

http://example.com?ks4day=Friday+September+13th

EDIT: The date in the URL

5条回答
  •  爱一瞬间的悲伤
    2020-11-29 06:59

    If that's what you are doing, the plus sign will not be the only one that is going to give you a hard time. The apostrophe ('), equals (=), plus (+) and basically anything not in the permitted URL characters (see Percent-encoding @ Wikipedia) is going to get escaped.

    What you are looking for is the decodeURIComponent function.

提交回复
热议问题