Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a views slideshow on the front page of the site.
In the "performance" admin area (where you can set things like page caching etc, in admin/configuration/development/performance), if I select the "Aggregate JavaScript files" checkbox, and then save the configuration, the slideshow stops rotating.
The only way I can get the slideshow to work is to leave the "Aggregate JavaScript files" box unchecked.
Is this expected?
Comments
Comment #1
joelstein CreditAttribution: joelstein commentedI have the same problem when aggregating Javascript, and saw the following error in my console:
"Uncaught SyntaxError: Unexpected token <"
When I disabled Views Slideshow, the error went away. When inspecting the error, I saw a bunch of Javascript files aggregated into one file, but where the error occurred, I saw an HTML page mashed in there (which is obviously throwing the error). It appeared Views Slideshow was adding an HTML page to the aggregated Javascript file?
In my case, my sites/all/libraries/json2.js file actually contained the wrong information. It had some HTML in there, but not Javascript. Don't know why, but replacing it with the actual json2.js file fixed the error for me. You might check that out.
Comment #2
petey318 CreditAttribution: petey318 commentedThanks joelstein - that was exactly the problem.
I don't really know how I got hold of an incorrect version of json2.js, since I thought I had followed the instructions for download and installation correctly.
But manually locating the file and replacing it with the correct one fixed the problem.
Comment #3
b8x CreditAttribution: b8x commentedThanks for the solution problem occurred because on the page https://github.com/douglascrockford/JSON-js we save file "json2.js" using the menu item when right click and this is not correct. we must select the json2.js file code and paste it in our file.
Comment #4
urlM CreditAttribution: urlM commentedPasting the code into the file worked for me to get the js aggregation working with views slideshow. Thank you!
Comment #5
RaulMuroc CreditAttribution: RaulMuroc commentedShould we work on Views Slideshow to avoid this bug.
Or is already commited a solution?
Comment #6
petey318 CreditAttribution: petey318 commentedI think Views Slideshow is OK - see comment #3 above; you just need to include the correct json code. (and not all installs of views slideshow will need this anyway)