<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; Смена адреса страницы]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=9142&amp;type=atom" />
	<updated>2014-01-13T06:03:13Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=9142</id>
		<entry>
			<title type="html"><![CDATA[Re: Смена адреса страницы]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=79138#p79138" />
			<content type="html"><![CDATA[<p>может есть какой-то другой способ изменить url в адресной строке без перезагрузки страницы?</p>]]></content>
			<author>
				<name><![CDATA[valentinka.solar]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=31566</uri>
			</author>
			<updated>2014-01-13T06:03:13Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=79138#p79138</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Смена адреса страницы]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=79134#p79134" />
			<content type="html"><![CDATA[<p>Доброго времени суток. Нужно сделать изменение url страницы без ее перезагрузи и не используя #hash. Пытаюсь разобрать пример найденные на просторах интернета <br /></p><div class="codebox"><pre><code>
&lt;a href=&quot;/three/&quot; onclick=&quot;followLink(event, this)&quot;&gt;третья страница&lt;/a&gt;
 
&lt;script type=&quot;text/javascript&quot;&gt;
 
function followLink(event, link)
{
    var nameLink = link.innerHTML;
    uploadContent(link.href);
    history.pushState({title:nameLink, href:link.href}, null, link.href);
    updateTitle(nameLink);
    event.preventDefault();
}
 
function updateTitle(title)
{
    var elm = document.getElementsByTagName(&#039;title&#039;)[0];
    elm.innerHTML = title;
}
 
function uploadContent(link)
{
    //тут реализуем загрузку части страницы с помощью AJAX
}
 
window.addEventListener(&quot;popstate&quot;, function(e) {
    uploadContent(e.state.href);                                     
    updateTitle(e.state.title);
}, false );
 
&lt;/script&gt;
 
&lt;/body&gt;
&lt;/html&gt;
</code></pre></div><p>Но в консоле появляется ошибка Uncaught TypeError: Cannot read property &#039;href&#039; of null. Судя по всему window.addEventListener не видит href, но я не могу понять в чем причина</p>]]></content>
			<author>
				<name><![CDATA[valentinka.solar]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=31566</uri>
			</author>
			<updated>2014-01-12T17:49:43Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=79134#p79134</id>
		</entry>
</feed>
