Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Loading Issue

    Hi codingforms.com,

    I hope you're well.

    I'm having a javascript problem. My web site has a drop down navigation bar and it's essential that it loads; preferrably first. However, I also have some javascript ads (Google ads, my own ads, and some pop unders). When I add some InVue ads, it stops my navigation bar from loading at all.

    Is there any way that I can insert some coding to make my navigation bar resolve first? I don't understand why it resolves last and I obviously can't have it not show up at all.

    I've searched the archives for this answer, but I couldn't find it. I found a couple of answers to remotely similar questions and I implemented them, but no luck. Any help will be greatly appreciated.

    Have a great day.

    Sincerely,
    Jason

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Jason7
    My web site has a drop down navigation bar and it's essential that it loads; preferrably first.
    Then do not use javascript to power it - unordered list of links does the job just fine. There are plenty users without scripting that will not be able to navigate your site, and your most important visitiors - SE bots - are among them.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #3
    New Coder
    Join Date
    Sep 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your reply, Vlady.

    So, are you suggesting I just code it in html? Right now, it's a drop down box with numerous links in it.

    Regards,
    Jason

  • #4
    New Coder
    Join Date
    Sep 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please forgive my ignorance, but this seems like an issue that a javascript coder should know quite well. I simply need my navigation bar to load first. Is there a way to make it do that?

    Any help or input will be greatly appreciated.

    Sincerely,
    Jason

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,471
    Thanks
    0
    Thanked 634 Times in 624 Posts
    A browser starts downloading files in the order that they are referenced in your page. As different files download at different speeds and the priority given to the different downloads may change from one access to the next it is impossible to predict what files will finish downloading first.

    Provided that there is no conflict between variable and function names between different scripts they should work correctly regardless of the order they download in. If there is a conflict then one or both wont work correctly regardless of the order that they are downloaded and the only difference the download order might make is which of them gives the error.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #6
    New Coder
    Join Date
    Sep 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your explanation, Stephen.

    Does anyone have a suggestion or a solution for me? I'm open to anything.

    Regards,
    Jason

  • #7
    New Coder
    Join Date
    Sep 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    :: friendly bump ::

  • #8
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you can do something like:

    function loadRest() {
    document.write(rest of html contents);
    }


    <div onload="loadRest();">dropdown navigation bar</div>
    rm -f /

  • #9
    New Coder
    Join Date
    Sep 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your suggestion. Can you or someone else dumb it down a little? You mean all of my page should be where it says "html contents"? Will this make my navigation bar load first? It looks like it will make it load last. Please excuse my ignorance and thanks, again.

    Regards,
    Jason

  • #10
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Will this make my navigation bar load first? It looks like it will make it load last.
    Did you get this kind of result when you tested the example?
    rm -f /

  • #11
    New Coder
    Join Date
    Sep 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, since I couldn't figure it out or get enough help, I've decided to give up trying to make it load first. What I did do is make it load in a window that slides in from the left.

    See here:

    Old: http://jcsm.org/Wisdom.htm
    New: http://jcsm.org/Wisdom2.htm

    Any feedback may be beneficial.

    Thanks,
    Jason

  • #12
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    proof of concept
    sequencial load based on onload event:

    Code:
    <html>
    <head>
    <script language="Javascript">
    function loadRest() {
        alert('Click OK to continue');
        var s = '';
        s += '<fieldset style="width:10px;">';
        s += '<legend style="border-style:solid; border-width:thin;"> load rest </legend>';
        s += '<img src="http://www.google.ca/intl/en_ca/images/logo.gif">';
        s += '</fieldset>';
        document.getElementById('putHere').innerHTML = s;
    }
    </script>
    </head>
    <body>
    <div id="putHere"></div>
    <fieldset style="width:10px;">
    <legend style="border-style:solid; border-width:thin;"> load first </legend>
    <img src="http://us.a1.yimg.com/us.yimg.com/i/ww/beta/y3.gif" onload="loadRest()">
    </fieldset>
    </body>
    </html>
    rm -f /

  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It would be beneficial for both you and your visitors if you familiarized yourself with the following document: http://www.w3.org/TR/WCAG10/
    That actually applies to both the OP and the last poster....

    ... Also, IE is not the only browser that is used to browse the web...
    Last edited by Vladdy; 09-27-2005 at 01:08 PM.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #14
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The world does not revolve around a theory. Providing the solution could be beneficial.
    rm -f /

  • #15
    New Coder
    Join Date
    Sep 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So, is it just a crapshoot regarding which javascript code resolves first?

    I need my ads to run after my navigation bar loads. Can someone help?

    Sincerely,
    Jason


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •