Duncan Murdoch
2015-Sep-12 16:42 UTC
[Rd] rgl/webGL complains about Javascript, even in recent online docs?
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
Dominick Samperi
2015-Sep-12 20:33 UTC
[Rd] rgl/webGL complains about Javascript, even in recent online docs?
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 >
Duncan Murdoch
2015-Sep-12 22:11 UTC
[Rd] rgl/webGL complains about Javascript, even in recent online docs?
On 12/09/2015 4:33 PM, Dominick Samperi 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.It only gives that message when things are so bad that no code is running at all. The bug you saw meant it showed up when it shouldn't; that should have been fixed, but we'll see. Duncan Murdoch> > > 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 >>
Dominick Samperi
2015-Sep-12 22:12 UTC
[Rd] rgl/webGL complains about Javascript, even in recent online docs?
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. 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 >>
Reasonably Related Threads
- rgl/webGL complains about Javascript, even in recent online docs?
- rgl/webGL complains about Javascript, even in recent online docs?
- rgl/webGL complains about Javascript, even in recent online docs?
- rgl/webGL complains about Javascript, even in recent online docs?
- knitr without R studio