you have to use domready otherwise you'll get errors

and once again it is quite easy to inject css in the head

external stylesheet
---------------------------

var e = document.createElement('LINK');
                        e.href = css;
                        e.rel = "stylesheet";
                        e.type = 'text/css';
                        document.head.appendChild(e);


inline stylesheet
------------------------


                            var e = document.createElement('STYLE');
                            e.type = 'text/css';
                            document.head.appendChild(e);

                            //inline stylesheet
                            if(window.ie) e.styleSheet.cssText =
styledeclaration;
                            else
e.appendChild(document.createTextNode(styledeclaration));


On Thu, Jan 8, 2009 at 1:41 PM, Michal <[email protected]> wrote:

>
> I think I was talking about including CSS, and not Javascript in the
> head, but I guess the same/similar method can be applied.
>
> I wonder, is it ok to access the head element, via document.head or
> Assets, before it has has even fully loaded? The point of my hack was
> to include extra CSS *before* the DOM has loaded, so there is no
> chance of any flash of content.
>
> Michal.
>
> On Jan 8, 11:40 am, "Thierry bela nanga" <[email protected]> wrote:
> > anyway,
> >
> > your idea is not bad, i'll take a look at it.
> >
> > loading js is quite simple
> >
> >                         var e = document.createElement('SCRIPT');
> >                         e.src = js;
> >                         e.type = 'text/javascript';
> >
> >                         //I don't think this has an effect
> >                         if(defer) e.defer = true;
> >
> >                         document.head.appendChild(e);
> >
> > or you may use mootools Assets class.
> >
> > On Thu, Jan 8, 2009 at 12:28 PM, Thierry bela nanga <[email protected]
> >wrote:
> >
> >
> >
> > > if you request js with ajax and eval it, if there is a document.write,
> >
> > > the content of your page will be replaced by what you write.
> >
> > > On Thu, Jan 8, 2009 at 12:22 PM, Michal <[email protected]>
> wrote:
> >
> > >> I completely agree that document.write is bad (that's why I called it
> > >> a hackish method), but I'm unfamiliar with your reason about the blank
> > >> page, can you explain?
> >
> > >> Michal.
> >
> > >> On Jan 8, 10:42 am, "Thierry bela nanga" <[email protected]> wrote:
> > >> > using *document.write* is bad and should be avoided when you use
> ajax,
> >
> > >> > you may have a blank page when you evaluate an expression after the
> page
> > >> has
> > >> > been loaded.
> >
> > >> > instead you should use dom manipulation to load your js file.
> >
> > >> > On Thu, Jan 8, 2009 at 11:37 AM, Michal <[email protected]>
> > >> wrote:
> >
> > >> > > If it's ok for me to chime in. I use a way to minimize flashing
> (which
> > >> > > I use and like), and a bit of hack to completely remove flashing
> > >> > > (which I have used in the past, but I think no more). Both of
> these
> > >> > > leave content accessible to search engines and users without
> > >> > > Javascript.
> >
> > >> > > To minimize flashing:
> > >> > > - In the CSS, create rules starting with ".js" that hide all your
> > >> > > content that you want hidden if JS active
> > >> > > - On domready, add the class .js to the body element. If this is
> the
> > >> > > first domready listener, this should minimize flashing.
> >
> > >> > > To completely remove flashing:
> > >> > > - Has a CSS file with style that hides the content you want
> hidden,
> > >> > > but *don't* put this in your page.
> > >> > > - Instead, in the head section of your page, include a Javascript
> file
> > >> > > that uses document.write that writes the link tag to the page.
> This is
> > >> > > hackish, and won't work if the page is sent as
> application/xhtml+xml.
> >
> > >> > > By the way neither of these methods are mine, but I forget where I
> saw
> > >> > > them.
> >
> > >> > > Michal.
> >
> > >> > > On Jan 8, 9:46 am, "Thierry bela nanga" <[email protected]> wrote:
> > >> > > > I had to make a choice,
> >
> > >> > > > All the content is present on the page and is available to
> search
> > >> bot,
> > >> > > but
> > >> > > > some parts are hidden to avoid flashing and they are displayed
> by
> > >> > > removing
> > >> > > > the .hidden class.
> >
> > >> > > > On Wed, Jan 7, 2009 at 11:07 PM, CroNiX <[email protected]>
> > >> wrote:
> >
> > >> > > > > You care if your site content is available to search bots but
> not
> > >> > > > > visitors?  Strange...
> >
> > >> > > > > On Jan 7, 6:55 am, "Thierry bela nanga" <[email protected]>
> wrote:
> > >> > > > > > yeah but,
> >
> > >> > > > > > I use JS to build the page (tabs, etc), without it you'll
> have
> > >> an
> > >> > > ugly
> > >> > > > > > content. the content remain available for search bots that's
> the
> > >> most
> > >> > > > > > important for me.
> >
> > >> > > > > > On Wed, Jan 7, 2009 at 3:47 PM, Guillermo Rauch <
> > >> [email protected]>
> > >> > > > > wrote:
> > >> > > > > > > Which makes the content unavailable for people with CSS on
> but
> > >> JS
> > >> > > off.
> >
> > >> > > > > > > On Wed, Jan 7, 2009 at 12:39 PM, Thierry bela nanga <
> > >> > > [email protected]
> > >> > > > > >wrote:
> >
> > >> > > > > > >> my method to avoid this is to hide content initially with
> > >> css, i
> > >> > > > > define a
> > >> > > > > > >> class .hidden {display: none} and then I use the domready
> to
> > >> > > remove
> > >> > > > > the the
> > >> > > > > > >> class.
> >
> > >> > > > > > >> On Wed, Jan 7, 2009 at 3:01 PM, keif <
> [email protected]>
> > >> > > wrote:
> >
> > >> > > > > > >>> FUC = Flash of Unstyled/Unrendered Content
> >
> > >> > > > > > >>> This cropped up mainly because of an alphaPNG script,
> > >> extended
> > >> > > > > > >>> elements script, and a couple other scripts that modifed
> the
> > >> > > page.
> >
> > >> > > > > > >>> On Jan 5, 7:46 am, Michal <[email protected]>
> wrote:
> > >> > > > > > >>> > FUC?? I think maybe I'm not that good with those
> internet
> > >> > > > > acronyms....
> >
> > >> > > > > > >>> > On Jan 5, 12:32 pm, keif <[email protected]>
> wrote:
> >
> > >> > > > > > >>> > > With putting scripts at the bottom, it's been more
> of a
> > >> > > "YMMV"
> > >> > > > > > >>> > > approach - I can't find the yahoo article, but it's
> been
> > >> > > > > discussed
> > >> > > > > > >>> > > more than once that many people say "put it in the
> > >> footer"
> > >> > > when
> > >> > > > > it's
> > >> > > > > > >>> > > not a practice they follow themselves because of
> certain
> > >> > > issues
> > >> > > > > (one
> > >> > > > > > >>> > > thing I've noticed, loading all JS in the footer
> causes
> > >> FUC
> > >> > > > > > >>> > > sometimes).
> >
> > >> > > > > > >>> > > -keif
> >
> > >> > > > > > >>> > > On Jan 5, 5:38 am, Nicolas Trani <
> [email protected]>
> > >> wrote:
> >
> > >> > > > > > >>> > > > Hi,
> >
> > >> > > > > > >>> > > > @Michal :
> > >> > > > > > >>> > > > Putting scripts at bottom speed up your page
> loading,
> > >> i
> > >> > > suggest
> > >> > > > > you
> > >> > > > > > >>> to
> > >> > > > > > >>> > > > read this :
> > >> > > > > > >>>
> http://developer.yahoo.com/performance/rules.html#js_bottom
> >
> > >> > > > > > >>> > > > @Wanlee :
> > >> > > > > > >>> > > > I suggest you to continue to use domready anyway.
> >
> > >> > > > > > >>> > > > Maye be you can post a page to show your code?
> >
> > >> > > > > > >>> > > > Regards.
> >
> > >> > > > > > >>> > > > Michal a écrit :
> >
> > >> > > > > > >>> > > > > Are you saying that 'domready' fires too early,
> > >> before
> > >> > > the
> > >> > > > > html
> > >> > > > > > >>> is
> > >> > > > > > >>> > > > > ready? This sounds strange. It could be:
> >
> > >> > > > > > >>> > > > > - A bug with domready. I suspect this is
> unlikely as
> > >> this
> > >> > > is
> > >> > > > > so
> > >> > > > > > >>> > > > > heavily used and tested. But if you can
> construct a
> > >> > > testcase,
> > >> > > > > > >>> post a
> > >> > > > > > >>> > > > > bug in lighthouse.
> > >> > > > > > >>> > > > > - A bug with your code somewhere: are you sure
> > >> everything
> > >> > > > > that
> > >> > > > > > >>> > > > > accesses the DOM is inside a domready listener?
> >
> > >> > > > > > >>> > > > > I have seen advice somewhere on the internet
> that
> > >> says
> > >> > > you
> > >> > > > > should
> > >> > > > > > >>> put
> > >> > > > > > >>> > > > > Javascript at the bottom of the html, but it's
> never
> > >> > > quite
> > >> > > > > sat
> > >> > > > > > >>> well
> > >> > > > > > >>> > > > > with me, it seems a bit hackish, but I don't
> quite
> > >> know
> > >> > > why.
> > >> > > > > I
> > >> > > > > > >>> always
> > >> > > > > > >>> > > > > put it in the head, with a domready. Maybe
> others
> > >> have
> > >> > > other
> > >> > > > > > >>> > > > > suggestions...
> >
> > >> > > > > > >>> > > > > There is the 'load' event, that waits for all
> images
> > >> to
> > >> > > load
> > >> > > > > as
> > >> > > > > > >>> well,
> > >> > > > > > >>> > > > > you could try that, but I suspect that there is
> > >> something
> > >> > > > > else
> > >> > > > > > >>> afoot.
> >
> > >> > > > > > >>> > > > > Can you post a link to the page you're talking
> > >> about?
> >
> > >> > > > > > >>> > > > > Michal.
> >
> > >> > > > > > >>> > > > > On Jan 5, 8:32 am, wanlee <
> [email protected]>
> > >> > > wrote:
> >
> > >> > > > > > >>> > > > >> I'm writing a few functions for sliders and
> json
> > >> > > requests
> > >> > > > > and it
> > >> > > > > > >>> > > > >> appears that the javascript is loading faster
> than
> > >> the
> > >> > > html
> > >> > > > > > >>> causing
> > >> > > > > > >>> > > > >> the slider to not initialize. it doesn't happen
> on
> > >> every
> > >> > > > > page
> > >> > > > > > >>> load but
> > >> > > > > > >>> > > > >> more so in safari.
> >
> > >> > > > > > >>> > > > >> moving my script tags to the bottom of the html
> > >> solves
> > >> > > the
> > >> > > > > > >>> problem. is
> > >> > > > > > >>> > > > >> this normal or could there be something wrong
> with
> > >> my
> > >> > > code?
> > >> > > > > > >>> should i
> > >> > > > > > >>> > > > >> use something other than 'domready'?
> >
> > >> > > > > > >>> > > > >> take swing!
> >
> > >> > > > > > >>> > > > --
> > >> > > > > > >>> > > > Nicolas Trani - web engineer
> > >> > > > > > >>> > > > Weelya - Improve the web
> > >> > > > > > >>> > > > 32 rue du faubourg boutonnet
> > >> > > > > > >>> > > > 34090 Montpellier
> > >> > > > > > >>> > > > Tel/Fax : 04 67 169 778http://www.weelya.com
> >
> > >> > > > > > >>> > > > Notre agence sera fermée du 12 au 16 janvier 2009
> >
> > >> > > > > > >> --
> > >> > > > > > >> fax : (+33) 08 26 51 94 51
> >
> > >> > > > > > > --
> > >> > > > > > > Guillermo Rauch
> > >> > > > > > >http://devthought.com
> >
> > >> > > > > > --
> > >> > > > > > fax : (+33) 08 26 51 94 51
> >
> > >> > > > --
> > >> > > > fax : (+33) 08 26 51 94 51
> >
> > >> > --
> > >> > fax : (+33) 08 26 51 94 51
> >
> > > --
> > > fax : (+33) 08 26 51 94 51
> >
> > --
> > fax : (+33) 08 26 51 94 51
>



-- 
fax : (+33) 08 26 51 94 51

Reply via email to