doggie brezy doggie brezy - 7 months ago 79
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?


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