Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many cookies on one domain result in weird browser behaviour #15209

Closed
SpazzMarticus opened this issue Nov 29, 2019 · 5 comments · Fixed by #15225
Closed

Too many cookies on one domain result in weird browser behaviour #15209

SpazzMarticus opened this issue Nov 29, 2019 · 5 comments · Fixed by #15225
Assignees
Labels
Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Milestone

Comments

@SpazzMarticus
Copy link

Since #14495 is merged navigatorAlias.cookieEnabled is not utilized any more, which results in a greater number of testcookies, which leads to strange browser-problems.

I am currently using Matomo on one domain with >100 different websites /subdivision-a, /subdivision-b. Some of the websites have multiple names: /subdivision-a = /alias-a)

setCookieDomain is set to *.example.org, setCookiePath is set to the specific path of a subdivision or alias (subdivision-a, alias-a)

Once a user visited too many pages and accumulated too many cookies their browser starts to act weird. Reloading the page does not work, or results in an error. (Deleting the cookies resolves the problem.)

Is there a chance that navigatorAlias.cookieEnabled will be used again if applicable, e.g. not on Modals in IE 11 #11507?
Or that the testcookie does not use getCookieName?
Is there a reason to use both configTrackerSiteId or domainHash for the testcookie?

I am aware that less testcookies don't solve my problem entirely, but reducing the number of cookies from n to 1 would be a big help. (If there are other solutions, I would appreciate any help.)

Thanks in advance!

@SpazzMarticus SpazzMarticus changed the title Too many cookies for one domain Too many cookies on one domain result in weird browser behaviour Nov 29, 2019
@tsteur
Copy link
Member

tsteur commented Nov 29, 2019

This sounds not good indeed.

e.g. not on Modals in IE 11 #11507?

by any chance do you know if / how this can be detected?

I suppose in worst case we would maybe need to detect IE in general see https://stackoverflow.com/a/21712356 using userAgent.indexOf('MSIE ') > 0 and userAgent.indexOf('Trident/ ') > 0? This be obviously not the best solution since IE would still have these issues but it would at least limit that problem.

@tsteur
Copy link
Member

tsteur commented Nov 29, 2019

Or that the testcookie does not use getCookieName?

I suppose this could be done too... we would just need to make sure to use our cookiePrefixName... @mattab I suppose there be no problem with this? Might be good to do this in general to avoid setting heaps of test cookies.

@tsteur tsteur added this to the 3.13.1 milestone Nov 29, 2019
@tsteur tsteur added the Regression Indicates a feature used to work in a certain way but it no longer does even though it should. label Nov 29, 2019
@SpazzMarticus
Copy link
Author

by any chance do you know if / how this can be detected?

Since showModalDialog is obsolete and can not be used in current browsers, maybe checking for window.showModalDialog could do the job:

function hasCookies() {
    if (configCookiesDisabled) {
        return '0';
    }
    if(window.showModalDialog !== undefined && isDefined(navigatorAlias.cookieEnabled))
    {
        return navigatorAlias.cookieEnabled ? '1' : '0';
    }
    var testCookieName = getCookieName('testcookie');
    setCookie(testCookieName, '1');
    return getCookie(testCookieName) === '1' ? '1' : '0';
}

@tsteur
Copy link
Member

tsteur commented Dec 2, 2019

Cheers @SpazzMarticus created #15225

Two awesome ideas there re testing for showModalDialog and only one test cookie overall and not per site...

@mattab
Copy link
Member

mattab commented Dec 5, 2019

@mattab I suppose there be no problem with this? Might be good to do this in general to avoid setting heaps of test cookies.

There should be no problem with this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants