host's external javascripts disrupt my onload scripts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Virgil Hobbs

    host's external javascripts disrupt my onload scripts

    My web host inserts banner ads into my html pages. The javascript in
    these banner ads interferes with the onload triggered javascript
    functions in my pages. Whether I trigger my javascript functions
    through onload=function () in the body tag or through
    window.onload=f unction name in a script, the host's advertising
    javascripts disrupt my javascripts that are supposed to run onload so
    that they do not run. I am not able to control the content of the
    javascripts my web hosts runs in my pages when ads are inserted in my
    pages.

    How do I solve this problem?









    Javascripts in your advertisements have been disrupting javascripts in
    my code that are supposed to trigger "Onload". The ads disrupt my
    onload commands whether I put them in the body tag or use
    window.onload.

    I would like to know what I can do so that my onload javascripts are
    not disrupted by the javascript in your ads.
  • Colin McKinnon

    #2
    Re: host's external javascripts disrupt my onload scripts

    David Virgil Hobbs wrote:
    [color=blue]
    > My web host inserts banner ads into my html pages. The javascript in
    > these banner ads interferes with the onload triggered javascript
    > functions in my pages. Whether I trigger my javascript functions
    > through onload=function () in the body tag or through
    > window.onload=f unction name in a script, the host's advertising
    > javascripts disrupt my javascripts that are supposed to run onload so
    > that they do not run. I am not able to control the content of the
    > javascripts my web hosts runs in my pages when ads are inserted in my
    > pages.
    >
    > How do I solve this problem?[/color]

    put your code inline at the end of your page instead of in the body.onload

    HTH

    C.

    Comment

    • Andrew Urquhart

      #3
      Re: host's external javascripts disrupt my onload scripts

      *Colin McKinnon* wrote:[color=blue]
      > *David Virgil Hobbs* wrote:[color=green]
      >> My web host inserts banner ads into my html pages. The javascript in
      >> these banner ads interferes with the onload triggered javascript
      >> functions in my pages. Whether I trigger my javascript functions
      >> through onload=function () in the body tag or through
      >> window.onload=f unction name in a script, the host's advertising
      >> javascripts disrupt my javascripts that are supposed to run onload so
      >> that they do not run. I am not able to control the content of the
      >> javascripts my web hosts runs in my pages when ads are inserted in my
      >> pages.
      >>
      >> How do I solve this problem?[/color]
      >
      > put your code inline at the end of your page instead of in the
      > body.onload[/color]

      Without testing it I'd assume that the following would help:

      if (window.attachE vent) {
      window.attachEv ent('onload', MyFunction);
      }
      else if (window.addEven tListener) {
      window.addEvent Listener("load" , MyFunction, false);
      }
      else {
      window.onload = MyFunction;
      }

      --
      Andrew Urquhart
      - FAQ: www.jibbering.com/faq/
      - Archive: www.google.com/groups?q=comp.lang.javascript
      - My reply address is invalid, see www.andrewu.co.uk/contact/


      Comment

      • David Virgil Hobbs

        #4
        Re: host's external javascripts disrupt my onload scripts

        vincemoon@rcn.c om (David Virgil Hobbs) wrote in message news:<6ed1146e. 0407220138.4836 6d50@posting.go ogle.com>...[color=blue]
        > My web host inserts banner ads into my html pages. The javascript in
        > these banner ads interferes with the onload triggered javascript
        > functions in my pages. Whether I trigger my javascript functions
        > through onload=function () in the body tag or through
        > window.onload=f unction name in a script, the host's advertising
        > javascripts disrupt my javascripts that are supposed to run onload so
        > that they do not run.[/color]

        The problem wass that in experimenting with the window.onload=f unction
        name approach in a web page of mine in which the onload javascripts
        were being disrupted by the ad code inserted by the web host, I placed
        the script containing the window.onload command above the point where
        the inserted ad code appears in my page. I did not realize that where
        in the page I place the script containing the window.onload command
        matters. The script containing the window.onload command in my case
        needs to be placed in the code after the point where the inserted ad
        code appears in my code and not before the place where the inserted ad
        code appears in my code.



        I am not able to control the content of the[color=blue]
        > javascripts my web hosts runs in my pages when ads are inserted in my
        > pages.
        >
        > How do I solve this problem?
        >
        >
        >
        >
        >
        >
        >
        >[/color]
        The following words should not have been in the newsgroup post they
        were in a letter sent to my web host.[color=blue]
        >
        > Javascripts in your advertisements have been disrupting javascripts in
        > my code that are supposed to trigger "Onload". The ads disrupt my
        > onload commands whether I put them in the body tag or use
        > window.onload.
        >
        > I would like to know what I can do so that my onload javascripts are
        > not disrupted by the javascript in your ads.[/color]


        After making the post that started this thread, I figured out the
        solution. The following code solves the problem, where derf3() is the
        function in the onload command in the body tag that is not being
        executed due to the javascripts in the ad code inserted by the web
        page host.

        <script>
        function init4()
        {
        derf3()
        }
        window.onload = init4;
        </script>


        I ca'nt help feeling upset that the online sources that explained the
        window.onload command, did not bother with explaining that it can
        matter where in the code you place the script containing the
        window.onload command.

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: host's external javascripts disrupt my onload scripts

          David Virgil Hobbs wrote:[color=blue]
          > My web host inserts banner ads into my html pages. The javascript in
          > these banner ads interferes with the onload triggered javascript
          > functions in my pages. [...]
          > How do I solve this problem?[/color]

          Move to another Web space provider. To circumvent the ads and anything
          related to them is illegal. The account is for free/cheap because of
          the ads.
          [color=blue]
          > [...]
          > Javascripts in your advertisements have been disrupting javascripts in
          > my code that are supposed to trigger "Onload". The ads disrupt my
          > onload commands whether I put them in the body tag or use
          > window.onload.
          >
          > I would like to know what I can do so that my onload javascripts are
          > not disrupted by the javascript in your ads.[/color]

          What's that?


          PointedEars

          Comment

          Working...