0

I try to get this effect in js / jquery

http://www.filmtv.it/post/33349/i-piu-letti-della-settimana-dal-9-al-15-luglio-2016/#rfr:home

load the content in a modal and in background the main page and also when u follow an url it change the address in the browser

http://www.filmtv.it/

I have find the half of my answer in this post

https://stackoverflow.com/a/13278783/492642

But how can I change the url in the browser ?

( sorry for my english )

Community
  • 1
  • 1
user492642
  • 169
  • 1
  • 3
  • 12
  • A. you can change the `hash`. B. You can use [`pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History_API#Example). – Mosh Feu Jul 18 '16 at 08:19

1 Answers1

0

First you should check, whether the browser supports the html5 history api, afterwards simply use history.pushState

if ('pushState' in history) {
  history.pushState(null, null, "http://example.com/some/different/url");
}

Important notice: The new url must have the same protocol and domain as the original url due to security reasons (so you cannot pretend to be a different site).

Detailled documentation: https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method

MattDiMu
  • 4,873
  • 1
  • 19
  • 29