Does caja.js perform run time check and code rewrite for jquery.js every 
time we call caja.load().run()? It's a big performance hit to scan the 
common jquery library every time we load the html fragment.

On Tuesday, July 8, 2014 2:20:59 PM UTC-4, Kevin Reid wrote:
>
> On Mon, Jun 30, 2014 at 7:47 AM, crystal <[email protected] 
> <javascript:>> wrote:
>
>> Hi, 
>>
>> In my app, we are trying to use caja to load a number of html fragments 
>> (html, css and js) from the same vendor. These 3rd party fragments all use 
>> same jquery library. The jquery library is fetched multi times by the proxy 
>> server for each guest fragment, each request with a different callback 
>> (/proxy?url=http://jquery-1.8.2&input-mime-type=text/javascript&callback=caja_ajax_7&alt=json-in-script).
>>  
>> This causes a big delay in loading the fragments. 
>>
>  
>>
> Dose caja come with some capability to cache the common js libraries for 
>> guest contents, or allow guests to share common js libraries? Thanks.
>>
>
> At a high level of abstraction, this falls into the category of "Caja 
> could use a better proxy service", one which functions more like a HTTP 
> cache should and without legacy characteristics from the cajoling-service 
> it was built into.
>
> However, for the situation you describe, I would recommend that you 
> eliminate the need for the proxy:
>
> 1. Have the vendor enable CORS 
> <http://en.wikipedia.org/wiki/Cross-origin_resource_sharing> for those 
> resources on their server(s).
>
> 2. In your Caja configuration, set the URI policy (specifically the 
> fetcher) so that it uses direct XHR rather than the proxy, either 
> unconditionally or specifically recognizing the domain serving the 
> fragments.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to