Ignore history.replacestate() when choosing to run scripts.

Fixes #1970

Refs #1083
Refs #1445
Refs #1631