On Thu, Aug 4, 2011 at 2:23 AM, Lasse Reichstein
<[email protected]> wrote:
>
>
> On Wed, Aug 3, 2011 at 8:46 PM, Diego Perini <[email protected]> wrote:
>>
>> Lasse,
>> for same-domain scripts I recall I could do that with a trick (reading
>> external scripts content).
>>
>> I don't have my old code at hand now (out of my country) but will try
>> to find it when back home.
>>
>> The trick requires setting a child IFRAME src attribute with the path
>> of the external script, then getting the IFRAME document textContent
>> and stripping the unneeded parts with a regexp.
>
>
> That should work, but for same-domain files, you can also just do an
> XMLHttpRequest.

Indeed true, but that requires an extra compatibility layer to
accommodate browsers difference in XMLHttpRequest implementation (IE
especially), so more code is needed to be loaded before being able to
use it.

> The iframe hack was what people did before XMLHttpRequest :)

Another advantage is that with an IFRAME the content will stick in the
cache, with XMLHttpRequest more headers and processing is needed to
achieve the same.

> For cross-domain files, you generally shouldn't be able to see their source
> - which also means that there is no way to see the external content of a
> script element with a src-attribute.

Could this be changed if the script provider used CORS headers ?

Diego

>
> /L
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to