UriKind in windows phone navigation between pages - windows-phone-7

I am a windows phone developer. I use NavigationService class for navigating to different pages. In this we use a UriKind property. What is this property actually means ?..
I googled it but not get a clear answer about it.
In msdn they provide as
RelativeOrAbsolute : The kind of the Uri is indeterminate.
Absolute : The Uri is an absolute Uri.
Relative : The Uri is a relative Uri.
But I don't understand it yet.. Can anyone please help me ?

Basically Uri will will be used to fetch the information from the specified path. In that UriKind will decide whether the patch is Absolute or Relative.
Relative Uri : - This Uri will not be having the detailed information about the file path like.
/Images/Nature.png
Absolute Uri : - This Uri will give the detailed information about the file path from the foot itself.
D:/Projects/TestingApplication/Images/Nature.png
Relative Or Absolute : - This Uri might be Relative or Absolute that means Indeterminate

Related

Laravel route is not letting me load my assets properly

In my laravel 9 project, when I have more than 4 '/' in my route, the project doesn't assets properly for that page. Because it includes the first keyword of my defined route.
For example: If I define a get route:
example.com/word1/word2/word3/word4/word5
In this case, all my other related routes such as my image links, where I've used route('/images/..')
The application loads the link: example.com/word1/images/... instead of example.com/images/...
I used '/' to solve this.
When you use a relative URL (e.g. /images/example.jpg), the browser will interpret it as being relative to the current page's URL. So if you're on a page with a URL like example.com/word1/word2/word3/word4/word5, then the relative URL /images/example.jpg will be interpreted as example.com/word1/word2/word3/word4/images/example.jpg.
To avoid this issue, you can use absolute URLs instead of relative URLs. An absolute URL includes the full URL, including the protocol (e.g. https://) and domain name. In your case, you can use the URL helper function to generate absolute URLs for your assets, like this: This will generate an absolute URL that includes only the domain name and the path to the asset, regardless of the current page's URL
<img src="{{ url('/images/example.jpg') }}" alt="Example">

Why is a URL not returned when using the pathto(document) helper function?

According to the Sphinx docs on templating, pathto(document) returns the path to a Sphinx document as a URL." By definition, a URL typically includes the scheme, the host, and the path component. So, why does pathto(root_doc) return index.html instead of, for example, https://example.com/index.html? index.html is not a URL. Can someone enlighten me? What is the best way to get an absolute URL for a document in Sphinx?
Use the setting html_baseurl. Without setting that value, the default is '', which omits the protocol and host.

Change path of gapi.client.request from relative to absolute

I want to use a refresh token to generate an access token. So I am making a gapi.client.request as shown below. I want to use host as 'accounts.google.com' (my actual path is 'https://accounts.google.com/o/oauth2/token') but the request is sent with path 'content.googleapis.com/o/oauth2/token'. The main problem is that gapi uses a relative url in the path parameter so even if i put the full path in 'path' it interpretes it starting with 'content.googleapis.com' followed by 'https://accounts.google.com/o/oauth2/token' which is obviously not even a valid url. So how do I set the path to be absolute rather than relative?
gapi.client.request({
'path':'/o/oauth2/token',
'method':'POST',
'params':{'rerfresh_token':refreshToken,'client_id':clientId,'client_secret':clientSecret,'grant_type':'refresh_token'}
});
request.execute();

How can I convert a relative link in Mechanize to an absolute one?

Is there is a way to convert a Mechanize relative-link object to another one which contains the absolute URL.
Mechanize must know the absolute link, because I can call the click method on relative links too.
You can just merge the page uri (which is always absolute) with the link uri:
page.uri.merge link.uri
This is not specific to Mechanize, but an easy way would be to use the base URL in the <base> tag and add it to the relative URL to use for whatever purpose you want. This generally works.
But, then I'm not sure if you could call the click method on that since I don't know Mechanize that well.
You can also use resolve
Example:
require 'mechanize'
agent = Mechanize.new
page = agent.get(url)
some_rel_url = '/something'
url = agent.resolve(some_rel_url)
Keep in mind that the other answers provided do not take into account all the possibilities to get the base url as described here
Basically this:

How to differentiate from the server side, between the first request of the browser (HTML file) and the following (images, CSS, scripts...)?

I'm programming a website with SEO friendly links, ie, put the page title or other descriptive text in the link, separated by slashes. For example: h*tp://www.domain.com/section/page-title-bla-bla-bla/.
I redirect the request to the main script with mod_rewrite, but links in script, img and link tags are not resolved correctly. For example: assuming you are visiting the above link, the tag request the file at the URL h*tp://www.domain.com/section/page-title-bla-bla-bla/js/file.js, but the file is actually http://www.domain.com/js/file.js
I do not want to use a variable or constant in all HTML file URLs.
I'm trying to redirect client requests to a directory or to another of the server. It is possible to distinguish the first request for a page, which comes after? It is possible to do with mod_rewrite for Apache, or PHP?
I hope I explained well:)
Thanks in advance.
Using rewrite rules to fix the problem of relative paths is unwise and has numberous downsides.
Firstly, it makes things more difficult to maintain because there are hundreds of different links in your system.
Secondly and more seriously, you destroy cacheability. A resource requested from here:
http://www.domain.com/section/page-title-bla-bla-bla/js/file.js
will be regarded as a different resource from
http://www.domain.com/section/some-other-page-title/js/file.js
and loaded two times, causing the number of requests to grow dozenfold.
What to do?
Fix the root cause of the problem instead: Use absolute paths
<script src="/js/file.js">
or a constant, or if all else fails the <base> tag.
This is an issue of resolving relative URIs. Judging by your description, it seems that you reference the other resources using relative URI paths: In /section/page-title-bla-bla-bla a URI reference like js/file.js or ./js/file.js would be resolved to /section/page-title-bla-bla-bla/js/file.js.
To always reference /js/file.js independet from the actual base URI path, use the absolute path /js/file.js. Another solution would be to set the base URI explicitly to / using the BASE element (but note that this will affect all relative URIs).

Resources