I have installed universal viewer and I am having aproblem getting it to work correctly. I have tried deactivating it, uninstalling/re -installing it. I have also tried deactivating other plugins all to no avail. Omeka dos not report an error.
However chrome dev console I get the error shown below.
You can see how it looks by following the link.
Thanking you in advance,
bundle.min.js:4 Uncaught (in promise) SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at Function.Deserialiser.parse (bundle.min.js:4)
at Object.create (bundle.min.js:5)
at Bootstrapper._loaded (bundle.min.js:9)
Deserialiser.parse @ bundle.min.js:4
create @ bundle.min.js:5
Bootstrapper._loaded @ bundle.min.js:9
(anonymous) @ bundle.min.js:9
This is the same issue than https://github.com/Daniel-KM/UniversalViewer4Omeka/issues/19.
There is a space that is sent just before the manifest json (see http://www.muckrosshouseresearchlibrary.ie/pochin_mould/iiif/2111134/manifest), and I don’t know where it is added. But the json itself is fine.
I just added a new option to follow strictly the json standard. Can you download (https://github.com/Daniel-KM/UniversalViewer4Omeka), check this option in the config and try it?
Thank you for you speedy reply.I tried the new option, unfortunately is has not resolved my problem.
I have also read the other post, what files should I be checking for a blank space.?
Any manifest like http://www.muckrosshouseresearchlibrary.ie/pochin_mould/iiif/2111134/manifest
If you download it with wget, you’ll see that there is a utf-8 bom at the start of the data.
I don’t have command line access. Is it possible to force strict json any other way. Via the .htaccess maybe?
If you use Apache, you can force utf-8:
But this is related to the server, its config, its relation to php and a lot of complex things, so I don’t know if it works.
I tried that to no avail.
I’ll keeping trying and let you know if i get anywhere.
Regards & Thanks again.
I found my problem. In /application/libraries/globals.php
There was a blank line at the top of the file. When I viewed it in notepad via ftp it looked fine(the blank line was not visible). It was only when I downloaded it and viewed it in a code editor that it became apparent.
Maybe this will help someone in the future.
Regards & Thanks john
This is a good piece of information for people to remember: you don’t necessarily need to use a “code editor,” but Notepad in particular is not a good choice, especially when you’re looking for line endings or blank lines.
Notepad ignores the “Unix-style” line endings that are common in lots of code, including Omeka’s.
I am getting a similar error, in my case its
Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
I can’t see a blank line on my globals.php as JohnHeff has mentioned, nor additional '<'
Already have the latest universalviewer plugin from github
P.S: pdfs are loading fine.the issue is only with images and videos.
This is not the same error. There is probably an internal error or a missing page in your server and the “
<” is the first character of it. If you check in the web developper tools (
ctrl + maj + i in Firefox or Chromium), you will get the content of this error.
Thanks for the reply Daniel,
The problem was caused due to having an incorrect Imagemagik path. Because of it the manifest file was garbled by an error message (related to missing thumbnails). All sorted now. Thanks.