Bug: page-cache.js:40 «Uncaught TypeError: element.prop is not a function»

How to fix

Replace the problem line with the new one:

.prop('href', element.src)


The element is a HTMLIFrameElement, it does not have the prop() method, but had the src property.

1 Like

See Also: GitHub Pull Request #4022

I have the latest version of Magento 2, and when I add my own iframe to a block, I get the exact same error. Also, the code in my version looks like

.prop('href', element.prop('src'))

So I’ll have to change it to the suggested code above

.prop('href', element.src)

Let’s see if this fixes it :slight_smile:

1 Like

And now the bug has disappeared after applying the patch to page-cache.js located in /vendor/magento/module-page-cache/view/frontend/web/js/

Is this really a bug it only happens when I loaded external libraries with requireJs.
Indeed I apply this patch and it fixes the error on Magento 2.1.4 .
Thank you.

It has been fixed on 2017-02-17 in the Magento 2.2 development branch: