alphagov / consent-api

Service for sharing user consent to cookies across multiple domains
https://consent-api-bgzqvpmbyq-nw.a.run.app
MIT License
8 stars 0 forks source link

fix: ie11 cross origin 443 ports #235

Closed guilhem-fry closed 7 months ago

guilhem-fry commented 7 months ago

A bug reported on Internet Explorer 11 from Ashley Burnett (gov.uk frontend):

_ the cross origin code in IE11 is not appending govuk_singleconsent_uid to links. This seems to be because the code is checking for the HTTP Port (port 80) but does not check for the HTTPS port (port 443). Therefore it can be fixed with something like this: function getOriginFromLink(link) {

    var origin = link.protocol.concat('//', link.hostname);
    if (link.port && link.port !== '80' && link.port !== '443') {
        origin = origin.concat(':', link.port);
    }
    if(link.href.indexOf('staging') != -1) {
        console.log("Getting origin from link")
        console.log(origin)
    }
    return origin;
}_