Skip to content

To maintain the state of object on URL in IE/Edge #107

Description

@mveer-agarwal

I have modified the firePopState method by adding a Map, which keeps the URL and state of object in case of IE/Edge.

function firePopState(currentUrl) {
        var o = document.createEvent ? document.createEvent('Event') : document.createEventObject();
        var currentUrl = currentUrl;
        var NextUrl = windowLocation.href;

        if (o.initEvent) {
            o.initEvent('popstate', false, false);
        } else {
            o.type = 'popstate';
        }

        if (historyMap[NextUrl]) {
            o.state = historyMap[NextUrl];
            delete historyMap[NextUrl];
            historyObject.replaceState(null, "", NextUrl);
        } else {
            historyMap[currentUrl] = historyObject.state;
        }
        // o.state = historyObject.state;
        // send a newly created events to be processed
        dispatchEvent(o);
    }

Please suggest.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions