Announcement

Collapse
No announcement yet.

Delay JavaScript execution

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Delay JavaScript execution

    Code:
     
    <script language='javascript' src='http://v11.mivainline.eu.miva.com/MivaLine/GetHighlightContext.aspx?pid=------REMOVED----'></script>
    That is the miva inline ad code I use on my forum, but I found that it slows down the loading of my pages a little bit.

    I placed it in the footer but I want it to load at the very end when the whole forum has loaded.

    Thanks
    Last edited by smsmasters; Tue 22nd May '07, 5:44pm.

  • #2
    Javascript will be retrieved by the client where ever the tag is placed in your code. If the processing is what is slowing things down then you can try modifying the beginning of your tag to look like the code block below. You should not, however, use this if the JavaScript changes the layout of your page (by adding an image, etc.) as it can have odd effects...

    Code:
    <script language='javascript' defer='defer' ...
    Jason Litka - Utter Ramblings

    Comment


    • #3
      Hi, thanks. I tried that code but it made my browser freeze as if it was stalling whilst executing the js.

      Is there a way to make the js code run independently from the rest of the website being loaded?

      Thank you

      Comment


      • #4
        EDIT: didn't work so well

        Any other ideas please?
        Last edited by smsmasters; Wed 23rd May '07, 6:25am.

        Comment


        • #5
          Toss the code on the Onload event. Onload doesn't run until the entire page has loaded.
          Translations provided by Google.

          Wayne Luke
          The Rabid Badger - a vBulletin Cloud demonstration site.
          vBulletin 5 API - Full / Mobile
          Vote for your favorite feature requests and the bugs you want to see fixed.

          Comment


          • #6
            I'm not very good with js, can someone please kindly try to modify it please?

            Thanks

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X