[Cubicweb] Preview with ViewerJS in CW

Christophe de Vienne christophe at unlish.com
Fri Apr 1 19:05:33 CEST 2016


Hello

Le 01/04/2016 18:49, Stéphane Bugat a écrit :
> Le 31/03/2016 22:08, Christophe de Vienne a écrit :
>> I guess it is because the Viewer is actually in the index.html file,
>> which cubicweb will not return when accessing ViewerJS/.
>>
>> Try adding 'index.html' explicitely.
>> You may also need to change the '#..' into '#../../..' since the viewer
>> is in a subpath.
>>
>> The resulting code would be:
>>
>>      href = _cw.data_url('ViewerJS/index.html') + '#../../..' + path

> Christophe, this did not work neither... However the error message is
> now "cette ressource est introuvable" (bad resource location). The
> number of parent dirs '../' does not have any effect.

Is this message displayed by ViewerJS which try to access the resource,
or by the browser who cannot load ViewerJS itself ?

If the former, try adding/removing '../'s, and have a look at the
'network' tab of the browser devtools so you get an idea of what URL the
viewer is actually hitting.

If the later, where did you extract ViewerJS sources ?

> I have to admit that the mechanism used by ViewerJS to capture the file
> to be viewed is not clear to me...

I think is entirely done on the client side.

-- 
Christophe de Vienne
Co-fondateur http://unli.sh



More information about the Cubicweb mailing list