0

So I am using the History API and I am trying to use the pushState() function :

I did this: history.pushState({'a': 'b'}, 'Document', "index2.html");

It gives me this error:

Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL '...' cannot be created in a document with origin 'null' and URL '...'.

1201ProgramAlarm
  • 32,384
  • 7
  • 42
  • 56
David
  • 624
  • 1
  • 6
  • 21

1 Answers1

2

Is it this issue? replaceState() with document origin null

If so, the answer there indicates that this works:

history.replaceState(null,null, window.location.pathname + "your thing here");
Cat
  • 4,141
  • 2
  • 10
  • 18