Meteorite session gets reset in IE 9 after navigating to another page via iron-router

I have two pages, for example pageA and pageB.

In article A, I am setting the value in session

var student = {
  studentNumber: 'ABCDEF'
}
Session.set('student', student);
var s = Session.get('student'); // returns an Object 
console.log(s);
Router.go('pageB'); // navigate to pageB

      

I can see that the session (student object) is set correctly.

In the event clicked on page B,

var student = Session.get('student');
if (typeof student === 'undefined') {
  console.log('student object is undefined');
  return;
}

      

For some reason the session was reset in IE 9. This problem only occurs in IE 9, not IE 10/11, Chrome, Safari.

I mark in IE 9. It seems that the page (eg pageB) reloads when we use Router.go('pageB');

to navigate to. Does it matter?

Thanks in advance.

Jake

+3


source to share


1 answer


It turns out that IE8 and IE9 don't pushState

, so Iron Router doesn't support variables when changing URLs with those browsers.

The issue is discussed and possible workarounds for github here .



It looks like the most complete solution is to add the HTML5-History-API to your project; according to the link above everything should work (although I haven't tried it myself).

Alternatively, as you've already found, you can use sessionStorage

to save information between updates in one session.

+1


source







All Articles