ngungo
ngungo

Reputation: 5322

D3: Change text in url without making request

Suppose I have a url "http://example.com?name=FOO" on the browser, how do I change it to "http://example.com?name=BAR" without making new request, like selecting and changing title text from "FOO" to "BAR".

d3.select("title").text('BAR');

Is there way or isn't? Thanks!

Upvotes: 0

Views: 150

Answers (1)

Sameer Shemna
Sameer Shemna

Reputation: 906

Just Javascript, D3.js not required for this. Try this:

window.location.search = "?name=BAR";

if you want to do it without refresh:

window.history.pushState("object or string", "Title", "/new-url");

Refer: http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/

Upvotes: 1

Related Questions