Questions tagged [url-fragment]

URL fragments are the part of the URL that appears after the hash(#) character. Fragments are never sent to the server as part of the URL request. Use with the [url] tag.

In URLs, a fragment is what appears after the # character

https://www.example.com/directory?query_string#url_hash

Fragments were originally used to force a browser to scroll to a specific id. For instance https://www.example.com#scroll-to-me would scroll to the div below in an document

<div id="scroll-to-me">Some content</div>

As browsers create a history event every time the hash changes, the URL fragment has become a programming tool unto itself. This data is not sent from the client to the server, however, so if you want to store data there, or interact with it, you must use .

See also

32 questions
1
vote
3 answers

Looking for regular expression that matches the first part of a URL fragment

I have a URL fragment like 'users/123/edit' and I would like to match the first part of the string (in this case 'users'). The URL fragment could also be just 'users' and it should also match 'users'. I could do it via JS find() and substr(), but I…
johnny
  • 8,696
  • 6
  • 25
  • 36
0
votes
0 answers

Part of url including and following a hash symbol ignored in some instances

My single page application (written in Elm) sends emails to people wishing to register with a hyperlink to the registration page. The url has the following format: http://www.domain_name/directory/page#register/user_email/jwt On a few occasions,…
0
votes
0 answers

How to share a URL with fragment in Safari on iPadOS

When I open a URL that ends in a fragment with Safari on iPadOS 15 (e.g. https://example.com/page#heading), Safari will scroll to the position identified by the fragment (heading). But when I then try to share that URL via Mail, the URL entered into…
maf
  • 305
  • 1
  • 9
0
votes
0 answers

Is it possible to match the url fragment in a chrome extension?

Currently using match patterns in chrome.contextMenus.create#targetUrlPatterns for a chromium extension, however I've run into an issue. Is it possible to somehow filter URLs by their fragment (the string following the hash)? My understanding is…
0
votes
1 answer

Subscribing to URL fragment not firing event on change in Angular

I am using Angular 13 and I am trying to subscribe to the ActivatedRoute 'fragment'. The subscription is only receiving a notification when the page first loads, but is not receiving updates when the fragment gets updated. Here is an example of what…
0
votes
0 answers

using sockets in Python to get information from a url fragment

I am writing a Python script that interacts with the Spotify API. To authenticate, I generate a url that looks something like this:…
0
votes
0 answers

Setting window.location.hash to empty string makes Firefox to add # sign to the URL

In Firefox 106.0.4 (in Mac), when doing window.location.hash = '' in the console for a normal URL e.g. https://example.com/, the browser automatically adds # sign to the end of the URL https://example.com/#. The behaviour does not occur in Chrome or…
Binh
  • 346
  • 2
  • 14
0
votes
1 answer

Show anchor/fragment in Rust Iron framework?

I'm building a tool around an oauth implicit flow, which means that I eventually need to pull the access token from some URL in a request. I'm trying to build with Iron (I've also looked at Warp), but it looks like anchor tags are stripped in the…
hjfitz
  • 399
  • 4
  • 15
0
votes
0 answers

Scroll to element in mat-dialog using fragment link

I'm implementing a list of posts in a dialog, where a post can quote another post. I would like to be able to scroll to the quoted post when clicking a link which looks like this: 123 However, when I click the link, it…
0
votes
1 answer

Servlet unable to get hash fragment from URL

Hi after redirection from OAuth server, I am unable to get the complete URL in my JAVA Servlet.My URL looks like below - https://host.vp.com/gui/MainPage.gdi#scope=openid%20profile&id_token=eyJ0eXAiOiJKV86sada0ajdasJUUEB343KHFKK I tried…
Cleonjoys
  • 504
  • 4
  • 10
0
votes
1 answer

How can one retain URL fragment after server-side redirection?

Specifically, I'm currently working on a Ruby on Rails app where I require this behavior, but I intentionally worded my title in a language and framework agnostic manner after realizing that a lot of the existing questions on SO refer to specific…
dVVIIb
  • 96
  • 5
0
votes
1 answer

How to reload page when hash.location are the same javascript

I have i button that puts the hash (#feed) and i want when i am on this page with that has, when click the button again it reloads the page with that hash(#feed). Is there some way to do that?
Lucca
  • 55
  • 6
0
votes
1 answer

jQuery - Append hash to href from current URL

Let's say I have this URL in the address bar: www.example.com/pt.html#myhash Also I have an anchor that links to Change Language What I wanted to archive is to append to that anchor the…
BornKillaz
  • 592
  • 7
  • 19
0
votes
0 answers

How to link to a page part without a URL fragment?

I need to add links to a web application that point to specific parts of another page in the same application. Normally, it is done using a URL with a fragment part (an element ID after the '#' character). Unfortunately, the application has already…
pkalinow
  • 1,619
  • 1
  • 17
  • 43
0
votes
0 answers

GTM Strips URL fragments breaking functionality

We have on our site a physician directory search which has been working cross platform for years. Over the last few months, we have been getting reports that the functionality is broken. My debugging into this issue has led me to find that GTM is…