JS Encode and Decode URL
1.Encode URL String
var url = $(location).attr('href'); //get current url
//OR
var url = 'folder/index.html?param=#23dd&noob=yes'; //or specify one
var encodedUrl = encodeURIComponent(url);
console.log(encodedUrl);
//outputs folder%2Findex.html%3Fparam%3D%2323dd%26noob%3Dyes
2.Decode URL String
var url = $(location).attr('href'); //get current url
//OR
var url = 'folder%2Findex.html%3Fparam%3D%2323dd%26noob%3Dyes'; //or specify one
var decodedUrl = decodeURIComponent(url);
console.log(decodedUrl);
//outputs folder/index.html?param=#23dd&noob=yes
3.HTML URL Endoding References
space %20
! %21
" %22
# %23
$ %24
% %25
& %26
' %27
( %28
) %29
* %2A
+ %2B
, %2C
- %2D
. %2E
/ %2F
...
etc
测试网址:http://www.w3schools.com/tags/ref_urlencode.asp
原文网址:http://www.sitepoint.com/jquery-decode-url-string/
JS Encode and Decode URL的更多相关文章
- 用node.js写个在Bash上对字符串进行Base64或URL的encode和decode脚本
一:自己这段时间经常要用到Base64编码和URL编码,写个编译型语言有点麻烦干脆就用node.js弄了个,弄好后在/etc/profile里加上alias就能完成工具的配置,先上代码: functi ...
- [LeetCode] Encode and Decode TinyURL 编码和解码精简URL地址
Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL sho ...
- 535. Encode and Decode TinyURL 长短URL
[抄题]: TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problem ...
- 535 Encode and Decode TinyURL 编码和解码精简URL地址
详见:https://leetcode.com/problems/encode-and-decode-tinyurl/description/ C++: class Solution { public ...
- 011_如何decode url及图片转为base64文本编码总结
一.咱们经常会遇到浏览器给encode后的url,如何转换成咱们都能识别的url呢?很简单,talk is easy,Please show me your code,如下所示: (1)英文decod ...
- Encode and Decode TinyURL
TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/desi ...
- Leetcode: Encode and Decode TinyURL
Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL sho ...
- 【Leetcode】535. Encode and Decode TinyURL
Question: TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/pro ...
- 535. Encode and Decode TinyURL(rand and srand)
Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL sho ...
随机推荐
- Raspberry pi之树莓派基础建设-2
1.ssh pi与本地文件传输 一般ssh是默认会支持sftp的,所以你可以考虑用filezila之类的ftp工具远程连接登陆 2.我考虑到要拍照,前提是你得有个摄像头,usb直接插上去 3.py ...
- php使用mysql和mysqli连接查询数据
mysql: <?php $code = $_POST['code']; $status = ""; $success = ""; $scookies = ...
- backtrack下vim的使用
root@bt:~# vim test.c //vim新建或者编辑test.c,执行后进入vim编辑器,按a键进入编辑状态,输入C代码 #include<stdio.h> void mai ...
- The source attachment does not contain the source for the file ActionSupport.class 错误
报错 Syntax error, insert ";" to complete FieldDeclaration 报错 The source attachment does ...
- android开发--sqlite数据库
一.SQLite简介 Google为Andriod的较大的数据处理提供了SQLite,他在数据存储.管理.维护等各方面都相当出色,功能也非常的强大.SQLite具备下列特点: 1.轻量级 使用 SQL ...
- Sql Server 按行处理表数据思路
SqlServer的游标当超过1000行左右的时候效率极其低下. DECLARE @Company VARCHAR(12)='' SELECT TOP 1 @Company=CompanyID FRO ...
- 4T_进程与进程间通信
∮进程 进程与程序 进程与程序是有区别的.刚吃完炸鸡腿,拿出一张餐巾纸,擦完嘴之后,在油乎乎的纸上写下以下文字 #include <stdio.h> void main() { print ...
- 图解GitHub基本操作
目录 一.注册并登陆到github网站 1.1.打开github网站首页(https://github.com/) 1.2.注册一个自己的github账号 1.3.登陆自己的github账号 二.创建 ...
- mybatis读取配置文件报错:Could not find resource configuration.xml
今天用idea编译mybatis的java项目时,一直报错,找不到config.xml 查看class文件夹,确实没有xml文件 也就是说,xml文件没在编译范围内 在pom.xml中,把xml文件加 ...
- 账号控管:NIS服务器
NIS服务器 sun最开始命名为 Yellow pages ,黄页, NIS = YP; 14.1 NIS的由来与功能 NIS--Network information services( ...