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 4 of 4
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Posts
    108
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Bookmark code leaves %20 in browser favorite

    I have a site where I'm using a home-grown social bookmarking tool. The user has an option to "Bookmark this page" to their browser.

    My code works, but the problem is that when I dynamically grab the document.title, the browser (both IE and FF) tries to resolve any spaces or special characters so that when the favorite is stored in the browser, the bookmark reads:

    "This%20Site%20Bookmark"

    instead of:

    "This Site Bookmark"

    I feel like there must be a simple function to resolve spaces, but I'm coming up blank, no pun intended...

  • #2
    Regular Coder
    Join Date
    Nov 2007
    Posts
    108
    Thanks
    14
    Thanked 0 Times in 0 Posts
    Actually, is the "unescape" function the way to go?

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,253
    Thanks
    203
    Thanked 2,557 Times in 2,535 Posts
    Quote Originally Posted by loamguy1 View Post
    Actually, is the "unescape" function the way to go?
    Well, why not try it and find out?

    Code:
    var txt = "This%20Site%20Bookmark"
    alert(unescape(txt));

  • #4
    Regular Coder
    Join Date
    Nov 2007
    Posts
    108
    Thanks
    14
    Thanked 0 Times in 0 Posts
    That's the ticket. It looks like it strips out ":", but it's much better than leaving the %20 in there.


  •  

    Posting Permissions

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