From within javascript, how can I load a script from another domain as a string?

I do not think so. If there were a way, it would violate the ban of cross domain downloads. I guess there is a way to relax these limitations by properly configuring the security on the browser, but it is messy and unreliable among other things because of browser dependencies.

You will have to do it on the server.

1 Yep, although that sounds like evalling :) – ChrisR Oct 23 '09 at 19:40.

You can't. The cross-domain security model implemented by browsers prevents this. You'd need to go through another a server on your domain as a proxy which can access the remote resource for you.

Do it with Ajax! Personally, I like using jQuery wherever I can. Here's an article that describes exactly what you want to do.

jquery-howto.blogspot.com/2009/04/cross-... However, you do need to have some server-side component for it to work. Even just a wee bit of PHP should do the trick.

It's definitely possible. Instead of using jQuery or other libraries that implements the JSONP technique, implement JSONP yourself! There's a few steps, but at the end, skip the "eval" part.

Instead do what you want to do with the javascript string... A nice in depth article is hard to find but here's one I quickly found: niryariv.wordpress.com/2009/05/05/jsonp-... JSONP is in fact, a pretty clever technique. Learning it just for the fun of it is worthwhile! Good luck.

I forgot, the script on the other domain should also be JSONP friendly – Mike Gleason jr Couturier Oct 24 '09 at 19:50.

I've heard some people say "when it gets interpreted instead of compiled". That would make PHP (for example) a scripting language.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions