doggie brezy doggie brezy - 1 year ago 143
jQuery Question

javascript history.pushState not working for iframe

I want to run a

and it works fine but when I load the page through an iframe element it refused to work. This is how my code looks like

newHref = $(this).attr('href');
history.pushState('', '', newHref);

But it's not working, Please anyone with an idea of how to achieve this?

Answer Source

Using history.pushState() changes the url of the iframe source page. To change the main url in the address bar you have to address it to the parent so use this

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download