Announcement

Collapse
No announcement yet.

What does javascript:window.location do?

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

  • What does javascript:window.location do?

    In this:
    Code:
    <a href="javascript:window.location=window.location">
    <img src="{imagesfolder}/vb_bullet.gif" border="0" align="middle"
    alt="$bbtitle : Powered by vBulletin version $templateversion">
    </a>
    what does the javascript statement do? I want to omit the gif here. Can I safely delete the entire reference?

  • #2
    Code:
    java script:window.location=window.location
    Simply reloads the page.
    When you set window.location to something, the browser goes to that something.

    And yes you can remove that code - hell I don't even know why it was put there.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment


    • #3
      Is it intended to make sure that a page is reloaded instead of retrieved from user's cache? If so, that would seem important. I take it that it doesn't have anything to do with the gif or does it? Should I just delete the img src and leave the a ref, although I think empty references aren't valid.

      Comment


      • #4
        No, the Javascript is only executed when the image is clicked - it's not performed every time the page is loaded.

        If you delete the image from the code you will simply have an empty link that no one can click.
        Chen Avinadav
        Better to remain silent and be thought a fool than to speak out and remove all doubt.

        גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

        Comment


        • #5
          Ahhhhhhhhh, I see now. Clever, but who would know to click on the image to reload the page?

          Thanks for the help. I will now confidently delete.

          Comment


          • #6
            Originally posted by samtha25
            Is it intended to make sure that a page is reloaded instead of retrieved from user's cache?
            Actually it's done this way so it is *not* reloaded from the server.

            Comment


            • #7
              I don't understand that, tubedogg. What will happen if I delete it?

              Comment


              • #8
                Nothing - the only way that gets invoked is if the user clicks on the graphic. It's just a standard link to reload the same page.

                Comment


                • #9
                  Right mouseclick

                  Hi there,
                  when you klick on this link with IE using the right mousebutton and "open in new window", your IE crashes

                  Any solution for this besides to tell the user not to use the right mousebutton with this

                  marc

                  Comment


                  • #10
                    Yes, simply add this code to the link:
                    Code:
                    oncontextmenu="return false;"

                    Comment


                    • #11
                      Re: Right mouseclick

                      Originally posted by marc_t
                      Hi there,
                      when you klick on this link with IE using the right mousebutton and "open in new window", your IE crashes

                      Any solution for this besides to tell the user not to use the right mousebutton with this

                      marc
                      it crashes in Opera as well. This link is nasty!

                      Comment


                      • #12
                        I just added oncontextmenu code and it still crashes with Opera.

                        I'll delete it also.

                        Comment


                        • #13
                          Opera crashes..? well now there's a surprise...

                          Comment


                          • #14
                            I simply removed that javascript from whereever it appears. All problems solved. I imagine hardly anyone would miss it.

                            Comment


                            • #15
                              Originally posted by Kier
                              Opera crashes..? well now there's a surprise...
                              At least with Opera 5.02 it does.

                              Comment

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