Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28602
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| From | "Christoph M. Becker" <cmbecker69@arcor.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Can AJAX request a .js file? |
| Date | Thu, 3 Sep 2015 00:11:23 +0200 |
| Organization | solani.org |
| Lines | 20 |
| Message-ID | <ms7s66$a64$1@solani.org> (permalink) |
| References | <9ba8b186-10e2-4510-b456-8d38608db644@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | solani.org 1441231878 10436 eJwNwokRACEIBLCWUFjEcnjc/ku4mwTqy/uYww0EVQKPPbOD1dfs6Dgjj4C9ONwvk2TeX0l9NqgSuA== (2 Sep 2015 22:11:18 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Wed, 2 Sep 2015 22:11:18 +0000 (UTC) |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| X-User-ID | eJwFwQkBwDAIA0BLBAK0cnhW/xJ25xaISYYH/fk7xQ/StnkNs6I4KrMKr25k7RYFYtZ66ckfE8sQdQ== |
| In-Reply-To | <9ba8b186-10e2-4510-b456-8d38608db644@googlegroups.com> |
| Cancel-Lock | sha1:MZgHokEMRttNODfhUCfUkdcEmS4= |
| X-NNTP-Posting-Host | eJwFwQERACAIA8BKzMGgjuDRP4L/QUGTrpDHxu52GiEjI33g4aXTxPBpa85D1aKBO9dwPgSlEFY= |
| Xref | csiph.com comp.lang.javascript:28602 |
Show key headers only | View raw
Jay Braun wrote:
> Can I use XMLHttpRequest to request a .js file, e.g.:
>
> request.open('GET', latest.js);
Basically, yes. Of course you have to put `latest.js` in quotes
(probably just a typo), and SOP applies as usual.
However, you would have to evaluate the script manually (i.e. the host
won't do it automatically). You may consider letting the host
environment do the work for you by dynamically adding a respective
script element, instead. You can circumvent client side caching by
adding a unique query string to the URI. IIRC, the FAQ[1] elaborates on
this.
[1] <http://pointedears.de/scripts/faq/cljs/>
--
Christoph M. Becker
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-02 14:47 -0700
Re: Can AJAX request a .js file? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-03 00:11 +0200
Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-02 15:15 -0700
Re: Can AJAX request a .js file? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-03 00:46 +0200
Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-03 12:50 -0700
Re: Can AJAX request a .js file? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-04 00:14 +0200
Re: Can AJAX request a .js file? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-04 00:44 +0200
Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-03 18:52 -0700
Re: Can AJAX request a .js file? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2015-09-04 18:28 +0200
Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-04 15:47 -0700
Re: Can AJAX request a .js file? Stefan Weiss <krewecherl@gmail.com> - 2015-09-05 03:12 +0200
Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-05 20:09 -0700
csiph-web