javascript - Click back button on browser shows raw script -
there ajax calls in page. have done used history api update history. in page /test make ajax request updates history , url set /test?query=true. on pop state ajax call made according current url.
// called in click event ajax call create history. var stateobj = { query: 'query' }; history.pushstate(stateobj, null, ?query=true); // called on popstate window.onpopstate = function(event) { $.ajax({ method: 'get', url: window.location.href, datatype: 'script' }); }
now when have state pused , url updated /test?query=true go other page /test2 , click browser button browser shows me raw js code js.erb file.
Comments
Post a Comment