Snip2Code is shutting down.
It has been quite a ride, since 2013 when we launched our first prototype: thanks to the effort of you guys we collected more than 3 million snippets!
We are very proud to help all our users to be more efficient in their jobs, and to be the central point to share programming knowledge for everyone.
Our basic service is free, so we always survived on our own resources to give you Snip2Code.
Unfortunately, we are no more in the financial position to sustain this effort, and therefore we are announcing here our permanent shut down,
which will take place on August 1st, 2020.
Please save your private snippets using our backup function in the settings, here.
IF YOU WANT TO SAVE SNIP2CODE, PLEASE CONSIDER DOING A DONATION!
This will allow us to pay for the servers and the infrastructure. If you want to donate, Contact Us!
by
82k 37
1
7
4,006
8
Top 1% !
Famous
Tagged
Easy-to-find
Specified
Debate
OpenSource
Popularity: 3069th place
Languagejavascript
LicenseMIT_X11
webHTML5

Change the address in the browser without reloading

In HTML5 it is possible to change part of the address in the address browser without reloading the page. This helps building single page site with elements of the UI addressable using a consistent URL.
See an example here: http://www.usatoday.com/ .
By clicking on any article box a popup within the same page shows the content, and the URL in the address bar changes.

browser compatibility for this feature is available here: 
http://caniuse.com/#search=pushstate
http://caniuse.com/#search=replacestate
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/374/Change-the-address-in-the-browser-withou?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
// This add a new state to the browser history and replace the path window.history.pushState( stateObj, 'content title', '/new-path'); // This replace the current state to the browser history and replace the path window.history.replaceState(stateObj, 'content title', '/new-path');
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus