1

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?

4

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
    This is the proper solution. – codestr Sep 28 '17 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'))

  • 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 Sep 5 '17 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'))
  • 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 Jul 28 '17 at 16:33
-2

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

  chmod -R 777 pub/static
  • Should never set permissions to 777 – TheWebsiteGuy Oct 31 '18 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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