Some change on 17th May has broken page navigation

Hi all,

Our site is running on Ruby on Rails - and the pages are fetched using Turbolinks.

This worked flawlessly since 2012 until 17th May 2021 6pm GMT - something, i can only assume has been changed on Cloudflare and now there is a javascript error being thrown on page navigation.

The page is fetched ok, but the javascript used to write the new URL into the address bar fails and a console error is spat out

Uncaught TypeError: e.startsWith is not a function
    at r (VM622 beacon.min.js:1)
    at History.e.pushState (VM622 beacon.min.js:1)
    at History.b.<computed> [as pushState] (fbevents.js:24)
    at e.update (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.push (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.pushHistoryWithLocationAndRestorationIdentifier (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.changeHistory (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.visitStarted (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.start (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.startVisit (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:39)
    at e.startVisitToLocationWithAction (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.visitProposedToLocationWithAction (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.visit (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38)
    at e.clickBubbled (application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:39)
    at application-39def3748ca5f1ca14877be9c854170e8de3637703db1876606e9dedb9a111b1.js:38
    at r (helpers.js:84)

I have confirmed this to be an issue at cloudflare level as i have no issues on my local development server - but i do have the same issue on my staging server which is running on Heroku along with the Live server.

If i bypass the cloudflare proxy on my staging server / live server, there is no issue anymore and it performs as it always has.

I don’t have much of anything switched on in cloudflare to disable (rocketloader etc.) - i tried disabling auto minify but no luck.

the above JS error has come out of the blue and started 6pm GMT on 17th May - i report errors to sentry and noticed the flood of them starting then. We’ve made no deployments to the code at our end.


Can you disable Cloudflare’s Browser Insights and see if the problem still happens?


yep that fixed the problem!

will this be addressed so i can continue to use this feature?

We should see if @jpl can check it out :slight_smile:

I found the same issue and disabling the Browser Insights worked.

I also experienced this! Ruby on Rails. Links stopped working all over my site. Also had the e.startsWith.. error.

Really crazy this small feature I can’t remember I enabled on my own just broke my site!!!

Yup same here, ruby on rails just randomly broke this morning may 19th CST

The issue appears to be that this function does not support pushState when the third parameter is a URL object. (It seems that a string was expected by the function).
As per MSDN’s sample using a URL object appears to be supported. History.pushState() - Web APIs | MDN

function r(e) {
    var t = "";
    if (t = window.location.origin ? window.location.origin : window.location.protocol + "://" +,
        if (String.prototype.startsWith || (String.prototype.startsWith = function(e, t) {
            return this.substr(t || 0, e.length) === e
            t += e;
            try {
                var n = new URL(e);
                return n.protocol + "://" + + n.pathname
            } catch (e) {}
    else {
        var r = window.location.pathname;
        r && r.length > 0 && (t += r)
    return t

Thank you all for the updates. Our Web Analytics team is aware of a possible issue and is currently reviewing. I can follow up here when a fix is released which will hopefully be soon.

1 Like

Hi Chris,

Thank you for the update.

Our Web Analytics team is aware of a possible issue and is currently reviewing.

You can mark that one as a definite issue for us as it broke our site.



Update: We’ve rolled out a fix today. Please purge the browser cache and test again. Please let us know if the issue persists.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.