location.assign()

書式

location.assign(URL)

説明

ページのURLを指定されたURLに置き換えます。location.replace()と同じ動作になります。Safar 2、iCab 3以降では動作しません。

サンプルコード [実行]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<script type="text/javascript"><!--
function newURL () {
location.assign("http://www.openspc2.org/");
}
// --></script>
</head>
<body>
<form>
<input type="button" value="assign" onClick="newURL()">
</form>
</body>
</html>