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

  • Home
  • SEARCH
  • 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 7534847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:08:11+00:00 2026-05-30T06:08:11+00:00

I have limited JS experience, and I need to split a string that would

  • 0

I have limited JS experience, and I need to split a string that would look something like:

http://example.com/#!/about

Into http://example.com/ and !/about

I can’t unfortuently use PHP and parsing the URL won’t work. Right??

This is what I have at the moment:

<script type="text/JavaScript">
var newUrl = window.location.pathname;
var hash=newUrl.split('#');
var f=hash[1];
</script>

I could do this for the 3rd line:

    var hash=newUrl.split('com'); 

And then account for the hash, but the problem with that is if someone goes to

example.com/index.php/#!/about

So I’d then have to double my code after this point.

Any ideas how to split the URL into two parts centring around the hash without having to use what I just mentioned??

  • 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. Editorial Team
    Editorial Team
    2026-05-30T06:08:12+00:00Added an answer on May 30, 2026 at 6:08 am

    The .pathname doesn’t include the hash. Use the .hash property instead. Use substring to strip the # character from the front.

    var hash = location.hash.substring(1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my limited experience, I've been on several projects that have had some sort
I have a limited c++ background and I would like to edit the registry.
I have a very limited experience of database programming and my applications that access
I have limited experience with .net. My app throws an error this.dateTimeFormat is undefined
I am a web-developer working in PHP. I have some limited experience with using
For example I have limited space and I want the submit button to appear
I sometimes need to use Visual Studio when I have limited screen real estate
Ok, so I am a student, and have VERY limited experience with databases, but
I have a very limited experience with Firefox extensions development (read XUL School ,
I am brand new to WCF, and have limited experience coding against web services.

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.