3

In product detail page I got below error in browser console at app/code/Magento/PageCache/view/frontend/web/js/page-cache.js

TypeError: element.prop is not a function

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

here I found one fix, but after that one new error appear that is

Error: Permission denied to access property "document" in http://domainname/pub/static/frontend/Vendor/theme/en_US/jquery.js

note: In luma theme product detail page works fine without any fix in page-cache.js

can anyone have an idea about root cause of the problem?

1

4 Answers 4

6

As the other answers are making changes to vendor and pub/static files:

Copy this file into your theme:

/vendor/magento/module-page-cache/view/frontend/web/js/page-cache.js

And change

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

To

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

You may need to clear browser and Magento cache. And possibly deploy static content depending on your workflow.

1
  • 1
    This is the proper solution.
    – codestr
    Commented Sep 28, 2017 at 15:23
0

Ankit was close.

Go to path and open page-cache.js

 /vendor/magento/module-page-cache/view/frontend/web/js/ 

Change line 40 of page-cache.js

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

To

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

1
  • Never edit files inside the vendor directory. This suffers from the same issue as Ankit's answer, if you change this you will likely lose your changes in future upgrades.
    – Ben Crook
    Commented Sep 5, 2017 at 14:51
-1

Go pub/static/frontend/<theme>/default/en_US/Magento_PageCache/js path and open page-cache.js

Change line 40 of page-cache.js

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

To

.prop('href', $(element).prop('src'))
1
  • Changing any files in pub/static is a waste of time as when you regenerate the static files you'll lose the fix.
    – Ben Crook
    Commented Jul 28, 2017 at 16:33
-3

Run following command in your root folder of Magento setup to set permission in Magento 2 :

  chmod -R 777 pub/static
1
  • Should never set permissions to 777 Commented Oct 31, 2018 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.