From murdoch.duncan at gmail.com  Sun Sep 13 01:43:30 2015
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Sat, 12 Sep 2015 19:43:30 -0400
Subject: [Rd] rgl/webGL complains about Javascript,
 even in recent online docs?
In-Reply-To: <CADUbQ5jTo8hhVsh6SKKHqb_ZEHAJvMjAi9ZMyQGO4eHg8y_oFA@mail.gmail.com>
References: <CADUbQ5jU5DJUVmojoC3rNRe9ORVqpRFJUp7B0TN4vaNQBwFfWg@mail.gmail.com>
	<55F40E78.6010101@gmail.com> <55F455D9.70807@gmail.com>
	<CADUbQ5jpYiF2OuST5wNBmjL0ZSnZW9=AcOHUc6M+od5n4DKHaw@mail.gmail.com>
	<CADUbQ5jTo8hhVsh6SKKHqb_ZEHAJvMjAi9ZMyQGO4eHg8y_oFA@mail.gmail.com>
Message-ID: <55F4B8A2.5000407@gmail.com>

On 12/09/2015 6:12 PM, Dominick Samperi wrote:
> FYI, one platform where I have not been able to get interactive rgl
> working is iOS 8.
> iOS 8 is supposed to support WebGL, and Javascript is enabled.

I'm not going to try to support iOS.

Duncan Murdoch



> On Sat, Sep 12, 2015 at 4:33 PM, Dominick Samperi <djsamperi at gmail.com> wrote:
>> Thanks for the pointers and the quick fix.
>>
>> Perhaps the generated HTML code should issue a
>> message like "Javascript load problem" instead of
>> "You must enable Javascript to view this page properly,"
>> because the latter can be misleading.
>>
>>
>> On Sat, Sep 12, 2015 at 12:42 PM, Duncan Murdoch
>> <murdoch.duncan at gmail.com> wrote:
>>> On 12/09/2015 7:37 AM, Duncan Murdoch wrote:
>>>> On 11/09/2015 10:14 PM, Dominick Samperi wrote:
>>>>> Hello,
>>>>>
>>>>> The recently created online "rgl Overview" at
>>>>> https://cran.r-project.org/web/packages/rgl/vignettes/rgl.html
>>>>> illustrates a problem that I am trying to resolve.
>>>>>
>>>>> At the bottom of each image block on that page appears the
>>>>> advisory: You must enable Javascript to view this page properly.
>>>>>
>>>>> I am using Safari under MacOS with Javascript and WebGL
>>>>> both enabled, so it must be the detection algorithm that is
>>>>> mistaken. It is not clear to me how this works after looking
>>>>> over the generated HTML code (generated by knit2html
>>>>> in my case).
>>>>>
>>>>> I found this after I ran into this problem in a different context,
>>>>> namely, in the process of creating a wordpress page that
>>>>> contains interactive rgl content. I tried simply placing
>>>>> the code generated by knit2html into a wordpress page,
>>>>> but the result is not interactive and that message about
>>>>> Javascript not being enabled appears.
>>>>>
>>>>> On the other hand, if I open the generated code in a
>>>>> browser directly, interaction works and there is no
>>>>> Javascript message.
>>>>>
>>>>> In summary, interactive rgl code works stand-alone, but
>>>>> not in wordpress, and not in the "rgl Overview" page.
>>>>>
>>>>
>>>> I see the same in Firefox, it's not just Safari.
>>>>
>>>> If I look at the browser console, I see errors indicating that rglClass
>>>> is not defined, and I don't see a block of Javascript code that should
>>>> have been inserted.
>>>>
>>>> If I install rgl from the source on CRAN, I see the same problem, so it
>>>> looks like an rgl bug.  I'll see if I can fix it.
>>>
>>> Yes, it was an rgl bug.  During my testing I always had knitr loaded
>>> before rgl, but when building the vignettes for the package, the load
>>> order is different, and the initialization was silently skipped.
>>>
>>> I'll soon be committing changes to R-forge to fix this, and eventually
>>> it will end up on CRAN.  At the moment it looks like I need to add this
>>> function:
>>>
>>> setupKnitr <- function() {
>>>   if (requireNamespace("knitr")) {
>>>     knitr::knit_hooks$set(webgl = hook_webgl)
>>>     knitr::knit_hooks$set(rgl = hook_rgl)
>>>     environment(hook_webgl)$commonParts <- TRUE
>>>     environment(hook_webgl)$reuse <- TRUE
>>>   }
>>> }
>>>
>>> and that should be called (just once) near the start of the vignette.
>>>
>>> Duncan Murdoch
>>>



[Rd] rgl/webGL complains about Javascript, even in recent online docs?
Duncan Murdoch