[Mediawiki-l] add new js.file

Jim Wilson wilson.jim.r at gmail.com
Fri Aug 31 16:48:35 UTC 2007


> According to a comment in the scriptalicious code, Safari 2 won't work
> with this

Yeah, I see what you mean.  That's too bad :(

Well, I guess the most compatible way to do it then is this:

document.write('<script type="text/javascript" src="
http://path/to/external/file.js"></script>');

-- Jim

On 8/31/07, Jim Higson <jh at 333.org> wrote:
>
> Jim Wilson wrote:
>
> > If you want to be really slick about it, you could try adding the
> > following to the article [[MediaWiki:Common.js]]
> >
> > (function(){
> > var s = document.createElement('script');
> > s.src = "http://path/to/external/file.js";
> > document.getElementsByTagName('head')[0].appendChild(s);
> > })();
> >
> > This will dynamically create the equivalent of this:
> >
> > <script src="http://path/to/external/file.js"></script>
> >
> > To your the document head.
>
> IIRC, According to a comment in the scriptalicious code, Safari 2 won't
> work
> with this, so you have to use the bad old document.write instead.
>
> Haven't tested it myself.
>
> --
> Jim
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>


More information about the MediaWiki-l mailing list