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

onTTFB woes with iOS #332

Open
cwli24 opened this issue Mar 18, 2023 · 1 comment
Open

onTTFB woes with iOS #332

cwli24 opened this issue Mar 18, 2023 · 1 comment

Comments

@cwli24
Copy link

cwli24 commented Mar 18, 2023

Howdy, I'm having trouble with getting onTTFB to work with automated iOS tests. Just a cursory look into getNavigationEntry() suggests it gets polyfilled, but I'm still running into trouble.

let waitForTTFB;
if (typeof PerformanceNavigationTiming !== 'undefined') {
  waitForTTFB = new Promise(resolve => {
    onTTFB(({ value, entries }) => {
      // do some calculations with nav entry

      resolve() // data is ready?
    })
  })
// ^ this _should_ work for iOS >= 15.2 completely... but I find that my promise doesn't get resolved.
// I test this same block against Chrome, Edge, FF, macOS Safari 16, Android (against multiple recent versions of each), and
// they all work fine.
} else if (typeof PerformanceTiming !== 'undefined') {
 // Had to do this since iOS < v15.2 doesn't support PerformanceNavigationTiming and wouldn't work with onTTFB in tests
}
@ap-shahar
Copy link

I have the same issue, TTFB won't fire on first page load when I inject the script using the IAB. It will fire after the second page load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants