One comment about this approach. window.location
is set statically when the page loads and will not detect changes that the user has made to the address bar after this time. This should not be a problem, but it is important to know.
html :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
</head>
<body>
<a href="javascript:void(0);"
onclick="alert(window.location);">click me</a>
</body>
</html>
"click me" onclick
. , - , , .
, , , - , .