JavaScript How to fix iOS 9 window.location issue for backbone.js window.location issue,window.location safari issue,window.location security

In iOS 9 beta, a bug (https://openradar.appspot.com/22186109) was introduced that meant that setting window.location.hash to some new value was not being updated until "some time" later. The exact meaning of "some time" is up for debate, but seems to be at least until the next js event loop tick.

As an example, you would do something like this:

location.hash = "abcd";
console.log(location.hash); // probably not "abcd"

setImmediate(function () {
  console.log(location.hash); // probably "abcd"
});

This has caused an issue in our site which is using backbone.js router with hashchange navigation. Imagine that at the start of this example, the route is 'foo', and that before 'foo' in the history was 'quux'.

We do something like this:

router.navigate('bar', { trigger: true, replace: false });

The backbone.js history class would be invoked and call the routers to handle the navigation:

function onFooRoute() {
  router.navigate('baz', { trigger: true, replace: true });
}

So we started on 'foo', went to 'bar' and then went to 'baz' (with replace set to true for the last one).

We expect that we should end up on 'baz', and going back in history will take us back to 'foo'.

The issue we saw is that having done all of this, and once everything was settled down, going back in the history via window.history.back(), we go back to 'quux' and not 'foo'. It appears that because of the bug, the entry for 'bar' doesn't stick into the browser history stack, and so the navigation to 'baz' replaces 'foo' instead of 'bar'.

My question is how best to fix this? Can I patch backbone.js to work-around this issue?

Answer:1

<ComponentB from="3/1/2016" to="12/1/2016" /> and in componentB's constructor I can do const { from, to } = this.props but my from to value is optional. I can't do this.state = { from, to } ...

<ComponentB from="3/1/2016" to="12/1/2016" /> and in componentB's constructor I can do const { from, to } = this.props but my from to value is optional. I can't do this.state = { from, to } ...

  1. destruction default value
  2. js destructure default value

$(window).scroll(function() { $scrollingDiv.css("display", (($(window).scrollTop() / $(document).height()) > 0.1) ? "block" : ""); }); How can I change the unit $(document).height()) > 0.1) ...

$(window).scroll(function() { $scrollingDiv.css("display", (($(window).scrollTop() / $(document).height()) > 0.1) ? "block" : ""); }); How can I change the unit $(document).height()) > 0.1) ...

  1. get document height using javascript

Input = ABCDEF ((3) abcdef),GHIJKLMN ((4)(5) Value),OPQRSTUVW((4(5)) Value (3)) Expected Output = ABCDEF,GHIJKLMN,OPQRSTUVW Tried so far Output = Input.replace(/ *\([^)]*\)*/g, "");

Input = ABCDEF ((3) abcdef),GHIJKLMN ((4)(5) Value),OPQRSTUVW((4(5)) Value (3)) Expected Output = ABCDEF,GHIJKLMN,OPQRSTUVW Tried so far Output = Input.replace(/ *\([^)]*\)*/g, "");

Without scale code works fine, but I need to center vertically an already scaled element. I am looking for solution using CSS or JS approaches. Also I can not use transform-origin CSS property because ...

Without scale code works fine, but I need to center vertically an already scaled element. I am looking for solution using CSS or JS approaches. Also I can not use transform-origin CSS property because ...

  1. center vertically absolute div
  2. center vertically absolute positioned element
  3. center vertically absolute element
  4. center vertically absolute
  5. center vertically absolute css
  6. css vertically center absolutely positioned element
  7. css center vertically absolute element
  8. position absolute center vertically
  9. position absolute center vertically and horizontally
  10. css position absolute center vertically
  11. center text vertically in absolute div
  12. center absolute div vertically and horizontally
  13. center div vertically position absolute
  14. css position absolute center vertically and horizontally
  15. vertically center div in absolute parent
  16. absolute position center vertically unknown height
  17. center absolute element vertically and horizontally
  18. vertically center image position absolute
  19. vertically center absolute text
  20. center div vertically without absolute