Questions tagged [url]

A URL (Uniform Resource Locator), is a universal identifier on the web. A URL is a reference to a web resource at a specific location, and provides a means for retrieving that resource.

Filter by
Sorted by
Tagged with
6354 votes
33 answers
4.1m views

How do I change the URI (URL) for a remote Git repository?

I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved "origin" to a NAS and successfully tested cloning it from here. I would like to know if I can change the ...
Bite code's user avatar
  • 588k
5728 votes
18 answers
1.7m views

What is the maximum length of a URL in different browsers?

What is the maximum length of a URL for each browser? Is a maximum URL length part of the HTTP specification?
Sander Versluys's user avatar
4968 votes
32 answers
1.3m views

What is the difference between a URI, a URL, and a URN?

What is the difference between a URL, a URI, and a URN?
Sean McMains's user avatar
  • 58.6k
3760 votes
26 answers
3.8m views

Get the current URL with JavaScript?

All I want is to get the website URL. Not the URL as taken from a link. On the page loading I need to be able to grab the full, current URL of the website and set it as a variable to do with as I ...
user avatar
3030 votes
21 answers
2.1m views

How do I modify the URL without reloading the page?

Is there a way I can modify the URL of the current page without reloading the page? I would like to access the portion before the # hash if possible. I only need to change the portion after the domain,...
Robin Rodricks's user avatar
2895 votes
22 answers
1.9m views

Encode URL in JavaScript

How do you safely encode a URL using JavaScript such that it can be put into a GET string? var myUrl = "http://example.com/index.html?param=1&anotherParam=2"; var myOtherUrl = "http://example.com/...
nickf's user avatar
  • 542k
2694 votes
73 answers
5.3m views

How can I get query string values in JavaScript?

Is there a plugin-less way of retrieving query string values via jQuery (or without)? If so, how? If not, is there a plugin which can do so?
2080 votes
41 answers
578k views

How to lazy load images in ListView in Android

I am using a ListView to display some images and captions associated with those images. I am getting the images from the Internet. Is there a way to lazy load images so while the text displays, the UI ...
lostInTransit's user avatar
1735 votes
63 answers
2.9m views

Get the values from the "GET" parameters (JavaScript) [duplicate]

I have a URL with some GET parameters as follows: www.test.com/t.html?a=1&b=3&c=m2-m3-m4-m5 I need to get the whole value of c. I tried to read the URL, but I got only m2. How do I do this ...
joe's user avatar
  • 34.9k
1619 votes
43 answers
1.2m views

How can I open a URL in Android's web browser from my application?

How to open an URL from code in the built-in web browser rather than within my application? I tried this: try { Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(download_link)); ...
Arutha's user avatar
  • 26.3k
1512 votes
41 answers
490k views

Path.Combine for URLs?

Path.Combine is handy, but is there a similar function in the .NET framework for URLs? I'm looking for syntax like this: Url.Combine("http://MyUrl.com/", "/Images/Image.jpg") which would return: "...
Brian MacKay's user avatar
  • 31.6k
1268 votes
62 answers
850k views

React-router URLs don't work when refreshing or writing manually

I'm using React-router and it works fine while I'm clicking on link buttons, but when I refresh my webpage it does not load what I want. For instance, I am in localhost/joblist and everything is fine ...
DavidDev's user avatar
  • 13k
1129 votes
33 answers
571k views

How do I get the current absolute URL in Ruby on Rails?

How can I get the current absolute URL in my Ruby on Rails view? The request.request_uri only returns the relative URL.
Jakub Arnold's user avatar
  • 86.4k
1057 votes
65 answers
704k views

What is the best regular expression to check if a string is a valid URL?

How can I check if a given string is a valid URL address? My knowledge of regular expressions is basic and doesn't allow me to choose from the hundreds of regular expressions I've already seen on the ...
Vitor Silva's user avatar
  • 17.4k
975 votes
27 answers
4.0m views

Get the full URL in PHP

I use this code to get the full URL: $actual_link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; The problem is that I use some masks in my .htaccess, so what we see in the URL is not ...
DiegoP.'s user avatar
  • 45.5k
952 votes
6 answers
997k views

URL encoding the space character: + or %20?

When is a space in a URL encoded to +, and when is it encoded to %20?
BC.'s user avatar
  • 24.5k
908 votes
4 answers
311k views

Linking to an external URL in Javadoc?

Something like: /** * See {@linktourl http://google.com} */
ripper234's user avatar
  • 226k
907 votes
37 answers
1.5m views

Download single files from GitHub

What are some tips on downloading a single file from a GitHub repo? I don't want the URL for displaying the raw file; in the case of binaries, there's nothing. http://support.github.com/discussions/...
Radek Simko's user avatar
833 votes
11 answers
1.2m views

Java URL encoding of query string parameters

Say I have a URL http://example.com/query?q= and I have a query entered by the user such as: random word £500 bank $ I want the result to be a properly encoded URL: http://example.com/query?q=...
user1277546's user avatar
  • 8,752
789 votes
35 answers
1.7m views

How to get URL parameter using jQuery or plain JavaScript?

I have seen lots of jQuery examples where parameter size and name are unknown. My URL is only going to ever have 1 string: http://example.com?sent=yes I just want to detect: Does sent exist? Is it ...
LeBlaireau's user avatar
  • 17.3k
766 votes
14 answers
261k views

What is a "slug" in Django?

When I read Django code I often see in models what is called a "slug". I am not quite sure what this is, but I do know it has something to do with URLs. How and when is this slug-thing ...
Jonas's user avatar
  • 19.6k
765 votes
6 answers
120k views

What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for?

I've just noticed that the long, convoluted Facebook URLs that we're used to now look like this: http://www.facebook.com/example.profile#!/pages/Another-Page/123456789012345 As far as I can recall, ...
BoltClock's user avatar
  • 713k
756 votes
8 answers
368k views

Hyphen, underscore, or camelCase as word delimiter in URIs?

I'm designing an HTTP-based API for an intranet app. I realize it's a pretty small concern in the grand scheme of things, but: should I use hyphens, underscores, or camelCase to delimit words in the ...
Josh Johnson's user avatar
  • 9,152
704 votes
30 answers
325k views

How do I create a URL shortener? [closed]

I want to create a URL shortener service where you can write a long URL into an input field and the service shortens the URL to "http://www.example.org/abcdef". Instead of "abcdef" there can be any ...
caw's user avatar
  • 31.2k
690 votes
21 answers
797k views

How to get the full URL in Express?

Let's say my sample URL is http://example.com/one/two and I say I have the following route app.get('/one/two', function (req, res) { var url = req.url; } The value of url will be /one/two. How ...
Chris Abrams's user avatar
  • 41.1k
639 votes
13 answers
701k views

Which characters make a URL invalid?

Which characters make a URL invalid? Are these valid URLs? example.com/file[/].html http://example.com/file[/].html
good's user avatar
  • 6,421
630 votes
19 answers
920k views

How to get GET request values in Django?

I am currently defining regular expressions in order to capture parameters in a URL, as described in the tutorial. How do I access parameters from the URL as part the HttpRequest object? My ...
sutee's user avatar
  • 12.7k
609 votes
42 answers
511k views

How to build a query string for a URL in C#?

A common task when calling web resources from a code is building a query string to including all the necessary parameters. While by all means no rocket science, there are some nifty details you need ...
Boaz's user avatar
  • 25.7k
588 votes
8 answers
694k views

What is %2C in a URL?

In a URL, what does the %2C encoding mean and what are its uses?
sameold's user avatar
  • 18.8k
563 votes
38 answers
740k views

Check if a JavaScript string is a URL

Is there a way in JavaScript to check if a string is a URL? RegExes are excluded because the URL is most likely written like stackoverflow; that is to say that it might not have a .com, www or http.
Bruno's user avatar
  • 8,747
526 votes
38 answers
264k views

Fixed page header overlaps in-page anchors

If I have a non-scrolling header in an HTML page, fixed to the top, having a defined height: Is there a way to use the URL anchor (the #fragment part) to have the browser scroll to a certain point in ...
Tomalak's user avatar
  • 335k
520 votes
37 answers
1.1m views

Adding a parameter to the URL with JavaScript

In a web application that makes use of AJAX calls, I need to submit a request but add a parameter to the end of the URL, for example: Original URL: http://server/myapp.php?id=10 Resulting URL: ...
Lessan Vaezi's user avatar
  • 7,207
516 votes
26 answers
619k views

How do I parse a URL into hostname and path in javascript?

I would like to take a string var a = "http://example.com/aa/bb/" and process it into an object such that a.hostname == "example.com" and a.pathname == "/aa/bb"
freddiefujiwara's user avatar
502 votes
8 answers
720k views

Redirecting to a relative URL in JavaScript

My problem is that I want to redirect via JavaScript to a directory above. My code: location.href = (location.href).substr(0, (location.href).lastIndexOf('folder')) The URL looks like this: example....
user199337's user avatar
  • 8,183
485 votes
19 answers
772k views

How can I download a file from a URL in C#?

What is a simple way of downloading a file from a URL path?
vbroto's user avatar
  • 6,232
482 votes
21 answers
1.1m views

How to check if the URL contains a given string?

How could I do something like this: <script type="text/javascript"> $(document).ready(function () { if(window.location.contains("franky")) // This doesn't work, any suggestions? { ...
RayLoveless's user avatar
  • 20.5k
475 votes
34 answers
484k views

How to convert URL parameters to a JavaScript object? [duplicate]

I have a string like this: abc=foo&def=%5Basf%5D&xyz=5 How can I convert it into a JavaScript object like this? { abc: 'foo', def: '[asf]', xyz: 5 }
Alex's user avatar
  • 67k
468 votes
8 answers
446k views

How do I load an HTTP URL with App Transport Security enabled in iOS 9? [duplicate]

So, the new beta SDK of iOS released last night has "App Transport Security" which encourages developers to use https instead of http. In principle, this is a great idea, and I already use https in ...
Graeme Mathieson's user avatar
457 votes
24 answers
539k views

Refresh image with a new one at the same url

I am accessing a link on my site that will provide a new image each time it is accessed. The issue I am running into is that if I try to load the image in the background and then update the one on ...
QueueHammer's user avatar
  • 10.7k
454 votes
6 answers
439k views

How do I URl encode something in Node.js?

I want to URL encode this: SELECT name FROM user WHERE uid = me() Do I have to download a module for this? I already have the request module.
TIMEX's user avatar
  • 266k
416 votes
6 answers
372k views

How can I percent-encode URL parameters in Python?

If I do url = "http://example.com?p=" + urllib.quote(query) It doesn't encode / to %2F (breaks OAuth normalization) It doesn't handle Unicode (it throws an exception) Is there a better ...
Paul Tarjan's user avatar
  • 49.8k
412 votes
19 answers
480k views

Get protocol, domain, and port from URL

I need to extract the full protocol, domain, and port from a given URL. For example: https://localhost:8181/ContactUs-1.0/contact?lang=it&report_type=consumer >>> https://localhost:8181
yelo3's user avatar
  • 5,753
410 votes
9 answers
207k views

When should I use a trailing slash in my URL?

When should a trailing slash be used in a URL? For example - should my URL look like /about-us/ or like /about-us? I am fully aware of the SEO-related issues - duplicate content and the canonical ...
Denis's user avatar
  • 4,828
385 votes
7 answers
310k views

URL encoding in Android

How do you encode a URL in Android? I thought it was like this: final String encodedURL = URLEncoder.encode(urlAsString, "UTF-8"); URL url = new URL(encodedURL); If I do the above, the http:// in ...
hpique's user avatar
  • 120k
381 votes
11 answers
1.0m views

Get URL query string parameters

What is the "less code needed" way to get parameters from a URL query string which is formatted like the following? www.mysite.com/category/subcategory?myqueryhash Output should be: myqueryhash I ...
enloz's user avatar
  • 5,774
373 votes
11 answers
313k views

How to check whether a string is a valid HTTP URL?

There are the Uri.IsWellFormedUriString and Uri.TryCreate methods, but they seem to return true for file paths, etc. How do I check whether a string is a valid (not necessarily active) HTTP URL for ...
Louis Rhys's user avatar
  • 35.1k
357 votes
18 answers
213k views

Should URL be case sensitive?

I noticed that HTTP://STACKOVERFLOW.COM/QUESTIONS/ASK and http://stackoverflow.com/questions/ask both works fine - actually the previous one is converted to lowercase. I think that this makes ...
Imageree's user avatar
  • 4,721
354 votes
18 answers
224k views

Is there any method to get the URL without query string?

I have a URL like http://localhost/dms/mduserSecurity/UIL/index.php?menu=true&submenu=true&pcode=1235. I want to get the URL without the query string: http://localhost/dms/mduserSecurity/UIL/...
saint's user avatar
  • 3,857
348 votes
18 answers
565k views

Get URL parameters from a string in .NET

I've got a string in .NET which is actually a URL. I want an easy way to get the value from a particular parameter. Normally, I'd just use Request.Params["theThingIWant"], but this string ...
Beska's user avatar
  • 12.6k
347 votes
51 answers
398k views

How do I get the YouTube video ID from a URL?

I want to get the v=id from YouTube’s URL with JavaScript (no jQuery, pure JavaScript). Example YouTube URL formats http://www.youtube.com/watch?v=u8nQa1cJyX8&a=GxdCwVVULXctT2lYDEPllDR0LRTutYfW ...
Adam Halasz's user avatar

1
2 3 4 5
872