SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Masking URL with onclick

    Hi,

    I have an issue, where I am using the onclick event to mask the url that shows in the status bar - thing is that it doesnt mask it until I refresh the page . . . or click on it once. The first time it still shows the url in the status bar when clicked. I looked at other people's examples and they had this same problem.

    Here is my code.

    <a href="http://www.url.com" onmouseover="status='This can happen if you want when someone mouses over a link'; return true;" onclick="status='This can happen if you want when someone clicks the mouse'; return true;">Mouseover Here</a>

    Is there a way to fix this? Or does anybody know another way to mask the URL completely?

    This is a client's request.

    Thanks

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how about
    <a href="this is not a URL" onclick="location.href='http://www.url.com';return false;">Muahahaha</a>

  3. #3
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Jim, ~ I will try that.

    The best response I have gotten is

    1) suggested using Mozilla which lets you disable javascripts status changing code.

    Or -

    2) to look into an Apache module called "mod_rewrite"

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have an issue, where I am using the onclick event to mask the url that shows in the status bar
    Forgive me my ignorance, but could you explain in more detail what you are trying to do, e.g. the exact steps you want to happen.

  5. #5
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wanted to mask the URL in the status bar at the bottom of the browser ~ just make it a different URL than what shows by default.

    I was able to change the defaultStatus ~, and change the status when someone mouses over a link . . . but not when someone holds the mouse down over the link. Well, actually it can be masked (with the onclick statement that I am using) but it only works after the first click or after the page is refreshed for some reason.

    I also tried doing a page reload/refresh right after you open the page (onload) but that didnt work either.

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One thing:

    If you are using <a href="my real url">, you can code till the cows come home masking what appears in the status bar, but if the user right clicks the link and does "copy shortcut" or whatever equivalent exists in browser-X, it will capture the URL.

    View source is another thing.

  7. #7
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am wondering why it would work after the first time holding the mouse click down though . . . or after the page is refreshed.

  8. #8
    SitePoint Guru
    Join Date
    Feb 2005
    Posts
    602
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not exactly relevant to the issue at hand, but you should use window.status instead of status because of a Mozilla bug.


Bookmarks

Posting Permissions

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