Polyfill js breaks website

  • Unknown's avatar

    Recently I updated my WordPress site. Then after a few days, I noticed an issue on all pages. When the cache is completely cleared and one page is loaded(except home page) a script is loaded in the page on the first load instead of the real page content. If I refresh the page then the page is loaded correctly(no script is loaded).
    I thought some plugin may be causing this issue and I tried disabling all plugins. But still, the issue exists. After some research, I found that the script that is being printed on the pages comes from a js file named wp-polyfill-fetch.min.js which is in the core files of WordPress. So I renamed this file and all other polyfill-related js and see that issue resolved. But as this is not a permanent fix I need you to help me out.
    On further investigation, I found a script in the admin dashboard that uses the polyfil js which was like this:
    `
    ( ‘fetch’ in window ) || document.write( ” );( document.contains ) || document.write( ” );( window.DOMRect ) || document.write( ” );( window.URL && window.URL.prototype && window.URLSearchParams ) || document.write( ” );( window.FormData && window.FormData.prototype.keys ) || document.write( ” );( Element.prototype.matches && Element.prototype.closest ) || document.write( ” );( ‘objectFit’ in document.documentElement.style ) || document.write( ” );
    `

    Does this have relevance in this issue? Please help me

  • Hi there,

    It looks like you’re in the wrong forum. It appears that you’re using the open-source WordPress software and therefore you need to seek help at these forums:

    https://wordpress.org/support/forums/

    These forums are for WordPress.com hosted sites only. If you want to know more about the differences between WordPress.com and the WordPress software you can read this document:

    WordPress.com vs. WordPress.org

  • The topic ‘Polyfill js breaks website’ is closed to new replies.