• 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:

    <script id='wp-polyfill-js-after'>
    ( 'fetch' in window ) || document.write( '<script src="https://muhdo.com/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js?ver=3.0.0"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src="https://muhdo.com/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js?ver=3.42.0"></scr' + 'ipt>' );( window.DOMRect ) || document.write( '<script src="https://muhdo.com/wp-includes/js/dist/vendor/wp-polyfill-dom-rect.min.js?ver=3.42.0"></scr' + 'ipt>' );( window.URL && window.URL.prototype && window.URLSearchParams ) || document.write( '<script src="https://muhdo.com/wp-includes/js/dist/vendor/wp-polyfill-url.min.js?ver=3.6.4"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src="https://muhdo.com/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js?ver=3.0.12"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src="https://muhdo.com/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js?ver=2.0.2"></scr' + 'ipt>' );( 'objectFit' in document.documentElement.style ) || document.write( '<script src="https://muhdo.com/wp-includes/js/dist/vendor/wp-polyfill-object-fit.min.js?ver=2.3.4"></scr' + 'ipt>' );
    </script>

    Does this have relevance in this issue? Please help me

    The page I need help with: [log in to see the link]

The topic ‘Polyfil js breaks pages’ is closed to new replies.