11

I have a basic link:

<a href="https://pieworld.com/apple#1/" target="_blank">Free Pie Here</a>

but when I click on it, I'm redirected to https://pieworld.com/apple

Everything after the hash mark, as well as the hash, are not included. This is only happening in IE10. I've tested without the target="_blank" as well, but the link still breaks at the hash.

Can't seem to find any documentation on this. The closest I've come to is this SO question, but it doesn't help.

Some background info that might help:

This is a .Net site

I'm redirecting from a http: to a https: site.

Community
  • 1
  • 1
itsclarke
  • 8,622
  • 6
  • 33
  • 50

7 Answers7

1

According to the RFC3986 https://www.rfc-editor.org/rfc/rfc3986 it is not OK to use this format. You should remove the trailing slash. If you have a trailing slash, it points to a directory within the server. Without it, you point to a document and with the hashmark you are allowed to point to a segment of the document. See example here.

Community
  • 1
  • 1
0

A hash character is used for bookmarks in an URL. To use a hash character as part of the URL itself, you need to URL encode it using %23:

<a href="http://pieworld.com/apple%231/" target="_blank">Free Pie Here</a>
Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • 1
    No luck, the new window opened with `http://pieworld.com/apple%231/` in the navbar, not `http://pieworld.com/apple#1/` – itsclarke Jan 30 '14 at 17:35
  • 2
    @BadDog: Yes, that is the correct way to write an URL that contains a hash character. If you don't encode it, everything after it becomes a bookmark. It's not possible to include a hash character in the URL that is sent to the server without encoding it. – Guffa Jan 30 '14 at 17:52
  • Why the downvote? If you don't explain what it is that you think is wrong, it can't improve the answer. – Guffa Jan 31 '14 at 08:17
  • Hashes are maintained on the client-side only, they do not get passed to the server. – davidcondrey Sep 01 '14 at 07:36
  • 1
    @dcc: Yes, they are, but in this case it *isn't* a hash (bookmark). The entire point with the question is that the OP *doesn't want* that part of the URL to remain in the client. – Guffa Sep 01 '14 at 08:18
  • I think the confusion (and downvotes) come from your use of the word 'bookmark'. – Stephan Muller Sep 10 '14 at 19:55
  • @StephanMuller: Maybe you are right, but why then? Does people dislike the word bookmark? – Guffa Sep 10 '14 at 20:15
  • 2
    It doesn't accurately reflect the meaning of what is called the "fragment identifier", and to be fair I've never before seen anyone call it a bookmark in any sense. – Stephan Muller Sep 10 '14 at 20:18
  • @StephanMuller: I can't say that I have seen it called anything other than a bookmark. It's quite easy to find pages that refer to them as bookmarks, for example this one in the Microsoft documentation: http://msdn.microsoft.com/en-us/library/aa259538(v=vs.60).aspx – Guffa Sep 10 '14 at 21:03
  • 2
    Interesting. Although that page also refers to a marquee, so I'm guessing it's old. Not saying you're wrong, just surprised at the usage of the word and thinking that it might have confused other readers too. – Stephan Muller Sep 10 '14 at 21:08
  • @StephanMuller: Yes, the page is quite old, so the marquee reference is naturally outdated as they aren't used any more, but bookmarks are still used. Here is another one that is from the documentation of the very latest version of the .NET framework: http://msdn.microsoft.com/en-us/library/ad09f4da%28v=vs.110%29.aspx – Guffa Sep 10 '14 at 21:15
0

Why do you have a trailing slash after the hash?

Try https://pieworld.com/apple/#1

That would be more standard. I've never heard of anyone putting trailing slashes after hash links.

3Dom
  • 795
  • 3
  • 10
  • 22
0

I Think, as the other folks suggested, that the website that you are trying to navigate to may interpret the /#1 as a folder/page inside the parent-page/document. Try removing the forward-slash before the #1 or look inside the html for the header's id/name tag so you can link it directly.
May also be a bug in IE10.
-Phantom

Phantom
  • 378
  • 3
  • 19
0

Any URL that contains a # character is a fragment URL. The portion of the URL to the left of the # identifies a resource that can be downloaded by a browser and the portion on the right, known as the fragment identifier, specifies a location within the resource.

http://www.httpwatch.com/features.htm#print

In HTML documents, the browser looks for an element with id attribute matching the fragment. For example, in the URL shown above the browser finds a matching tag in the Printing Support heading: <h3 id="print">Printing Support</h3> and scrolls the page to display that section.

I am not sure if the slash after the hash is supported. If you didn't mean to use it as a fragmented url, you should remove the hash or replace it.

djboris
  • 171
  • 8
0

The syntax of the Location header field has been changed to allow all URI references, including relative references and fragments, along with some clarifications as to when use of fragments would not be appropriate. (Section 7.1.2)

for more information check this thorough post.

Community
  • 1
  • 1
Adamski
  • 839
  • 2
  • 10
  • 28
-1

Hash removed from URL when back button clicked IE9 , IE10 IE11

In IE10 browser, first time on clicking the HREF link, then it comes to the correct below url: http://www.example.com/yy/zz/ff/paul.html#20007_14

If back button is clicked from the IE10 browser and again clicked the HREF link , then it comes to the below url: http://www.example.com/yy/zz/ff/paul.html

Solution :

Please change your url with https

It works for mine