Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 59489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:00:48+00:00 2026-05-10T18:00:48+00:00

I am trying to link to a file that has the ‘#’ character in

  • 0

I am trying to link to a file that has the ‘#’ character in via a window.open() call. The file does exist and can be linked to just fine using a normal anchor tag.

I have tried escaping the ‘#’ character with ‘%23’ but when the window.open(myurl) gets processed, the ‘%23’ becomes ‘%2523’. This tells me that my url string is being escapped by the window.open call changing the ‘%’ to the ‘%25’.

Are there ways to work around this extra escaping.

Sample code:

<script language='javascript'> function escapePound(url) {    // original attempt    newUrl = url.replace('#', '%23');    // first answer attempt - doesn't work    // newUrl = url.replace('#', '\\#');     return newUrl;  } </script> <a href='#top' onclick='url = '\\\\MyUNCPath\\PropertyRushRefi-Add#1-ABCDEF.RTF'; window.open(escapePound(url)); return true;'>Some Doc</a> 

URL that yells says ‘file://MyUNCPath/PropertyRushRefi-Add%25231-ABCDEF.RTF’ cannot be found

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:00:48+00:00Added an answer on May 10, 2026 at 6:00 pm

    You seek the dark magicks of encodeURI:

    window.open('http://your-url.com/' + encodeURIComponent('foo#123.jpg')); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a javascript link that references another .js file. I've been trying to
I am trying to read in a file that has HTML list items with
I'm trying to link an XSD file to an XML file. During validation, I
I am trying to link to a LESS stylesheet with Django. The file is
I'm trying to create an NSURL containing a link to an audio file inside
I have an html that has a link: <a id=myLink href=/aa.html title=New Bangoo class=bangoo>Bangoo</a>
I have an HTML file that has a set of divs with the class
I'm attempting to learn how to read in an access/zip file that has an
I'm trying to create a 'debug' shared library (i.e., .so or .dll file) that
I'm trying to insert some HTML at a given point. The XML file has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.