---
title: " parent.window.location.href 和 iframe中src的乱码问题"
author: "lijackly"
date: "2009-06-15T15:43:52Z"
tags: []
slug: "parent-window-location-href-iframe-src"
draft: false
lastmod: "2009-06-15T15:43:52Z"
id: 408686
url: "https://lijackly.iteye.com/blog/408686"
---

parent.window.location.href 和 iframe中src的乱码问题。

要在这两个url地址中传中文，必须加编码，然后再解码。

编码：encodeURI(encodeURI("包含中文的串"))
解码：java.net.URLDecoder.decode("需要解码的串","utf-8");