javascript - Update address bar value after slider change -


i have price slider can used filter product results. it's ion range slider found here.

when user has finished dragging slider, xmlhttp request sent database , products refresh without page reload.

it's @ point i'd update url match contents of page. example if user accesses following page:

mywebsite.com/a-product-category/ 

and sets price slider $10 - $40, i'd url change to:

mywebsite.com/a-product-category/10-to-40 

is there simple way in jquery or javascript? i've attemped various ways of implementing pushstate doesn't work me. maybe i'm doing wrong:

if (!this.dragging) {     window.history.pushstate({}, '', '/10-to-40'); } 

any appreciated. thanks.

edit:

i've created 2 versions of i'm after, 1 window.history.pushstate({}, '', '/10-to-40'); line , 1 without.

without pushstate: (link no longer works)

with pushstate: (link no longer works)

as can see, slider works in first example not in 2nd. here error on second page:

securityerror: operation insecure.

this refers line 982, pushstate.

is there reason it's insecure? thanks

edit 2:

it due working on subdomain. changing pushstate complete url fixed issue.

if (!this.dragging) {     window.history.pushstate({}, '', 'http://dev.mywebsite.com/a-product-category/10-to-40'); } 

thanks


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -