Re: Canvas issue with noscript

On 12/25/2011 4:26 AM, Benjamin Hawkes-Lewis wrote:
> On Sun, Dec 25, 2011 at 2:33 AM, Charles Pritchard<chuck@jumis.com>  wrote:
>> We need a means for noscript to show the fallback content of the Canvas
>> element.
>> http://noscript.net/
> [snip]
>
>> I'd really--really-- like NoScript to work well in this situation.
> Given noscript allows selective activation of scripts by domain, and
> given that the origin of the script may be different from that of the
> DOM containing the canvas, what might the UI for this look like?

That's a good point, and I hadn't thought of it. My thinking was that 
this behavior should be based on the domain serving the page itself .

So, whatever the html page is, the primary origin, that's where security 
should be checked. If that origin is not trusted to run scripts, then 
the canvas element should not render and the fallback should be used.

>
>> Currently, I use some very nasty CSS and JS hacks to get the appropriate
>> effect.
> What do you currently do?

I use a page with full fallback content outside of <canvas>, then I use 
javascript inline to toggle that fallback content to display: none 
immediately.

<div id="mycontent">
My Fallback Content!
</div>
<script>document.getElementById('mycontent').style.display = 'none'; 
</script>


> Can you point to a live example?
>
> What stops you create the<canvas>  node from the script that is going
> to make it work, rather than putting it into the DOM before you know
> that script will execute?

It's rather typical in canvas apps that the canvas tag has been authored 
into the HTML.
However, that is something that can be worked around, like the above 
example.

It'd not be appropriate to use a Loading style indicator, as in a 
non-scripted environment, we'd never expect the loading to finish.

As for the immediate display: none, it still has some effects during 
rendering, especially the first time the page is loaded.

I'm sure there are additional techniques. If you know others, please, do 
share.
IE is the easiest to use here during debugging, as I can simply switch 
on IE8 compatibility mode, where Canvas was absent.

It's nice to have the ability to see the fallback content inline as part 
of debugging tools. That, and noscript, are two reasons why I'm trying 
to find a resolution to this.


-Charles

Received on Sunday, 25 December 2011 13:04:39 UTC