ruby on rails - Turbolinks 3 and render a partial -
i'm excited turbolinks3(it allows render partial , not reload body) can read more here: https://github.com/rails/turbolinks/blob/master/changelog.md it's amazing i've problem: in browsers doesn't support pushstate(example ie8/9), don't know how manage behavior. give me error on ie8:
could not set innerhtml property. invalid target element operation.
my controller code is:
def create @post = post.find(params[:post_id]) if @post.comments.create(comment_params) render '_comment', change: [:comments, :super_test], layout: false, :locals => { comment: @post.comments.last } else render json:'error' end end
a 'solution' do:
redirect_to @post, change: [:comments, :super_test]
but problem reply lot of data don't need!(and response time bigger) reallt want find solution.
how can resolve problem ? i've thought 2 solution: 1) use history.js / modernizr polyfill pushstate on old browsers
but i've tried same error(like if don't have modernizr)
webpage error details
user agent: mozilla/4.0 (compatible; msie 8.0; windows nt 6.1; wow64; trident/4.0; slcc2; .net clr 2.0.50727; .net clr 3.5.30729; .net clr 3.0.30729; media center pc 6.0) timestamp: sat, 25 apr 2015 17:28:52 utc
message: not set innerhtml property. invalid target element operation. line: 26 char: 30464 code: 0 uri: https://stark-forest-5974.herokuapp.com/assets/application-83a3aa4fd4a1ee124da87760bfdca86febd4fc1cb8a13167c892a15ce3caa53d.js
2) find way check if request done turbolinks/pjax or not...and use conditional render or redirect_to
- but i've not idea on how can it, because turbolinks doesn't send specific header jquery-pjax
any suggestions ? appreciate it!
ps: please don't suggest me backbone/angular/ember/react, know them(backbone), want try turbolinks.
your first instinct right, ie8 you'll need modernizr. problem neither code or turbolinks here, it's ie8.
ps: turbolinks doesn't replace js frameworks, can use 1 of them if want. did use react , angular. turbolinks avoids re-loading same thing several times (wich feels magic).
Comments
Post a Comment