absolute-path

Is there a path similar to file:///android_asset/ that points to the apps directory?

柔情痞子 提交于 2019-12-03 03:09:14
I'm using a WebView to open some files saved to the app. Is there a way to link to the app's directory where files saved at runtime would be, in a similar way that file:///android_asset/ does? By link I mean loadUrl( *path* ) and also in the HTML markup of the file being opened <img src="*path*" /> As oppose to using an absolute path like file:///data/data/PACKAGENAME/files/ gregm Use this for files on the SD card: content://com.android.htmlfileprovider Use this for files in your assets directory: file:///android_asset Also, if you want to have all your references in your web view use that

getting the absolute path of a <img/>

南笙酒味 提交于 2019-12-03 02:09:42
Using Javascript, is there a standard way to get the absolute path of an image? img.getAttribute("src") only returns the src attribute as it was declared in the HTML. Just do .src . $('img')[0].src = '/images/foo.gif' "/images/foo.gif" $('img')[0].src "http://stackoverflow.com/images/foo.gif" $('img')[0].getAttribute('src') "/images/foo.gif" 来源: https://stackoverflow.com/questions/3496491/getting-the-absolute-path-of-a-img

NodeJS - convert relative path to absolute

邮差的信 提交于 2019-12-03 00:58:10
In my File-system my working directory is here: C:\temp\a\b\c\d and under b\bb there's file: tmp.txt C:\temp\a\b\bb\tmp.txt If I want to go to this file from my working directory, I'll use this path: "../../bb/tmp.txt" In case the file is not exist I want to log the full path and tell the user: "The file C:\temp\a\b\bb\tmp.txt is not exist" . My question: I need some function that convert the relative path: "../../bb/tmp.txt" to absolute: "C:\temp\a\b\bb\tmp.txt" In my code it should be like this: console.log("The file" + convertToAbs("../../bb/tmp.txt") + " is not exist") Use path.resolve try

How to determine absolute path (if any) of a loaded Class?

走远了吗. 提交于 2019-12-02 21:02:45
Is there a (compatible, if possible) way to determine the absolute path of a loaded Class? Of course, this is not always possible (if you think of dynamically created classes), but if the loaded Class is inside a jar how to get the absolute path for this jar? MyClass.class.getProtectionDomain().getCodeSource().getLocation().getPath() Fullcode: package org.life.java.so.questions; /** * * @author jigar */ public class GetClassPath { public static void main(String[] args) { System.out.println(GetClassPath.class.getProtectionDomain().getCodeSource().getLocation().getPath()); } } Output: /C:

Asp.Net Absolute Path of a URL

∥☆過路亽.° 提交于 2019-12-02 14:12:08
To make it simpler for a webapp to share files with another app on a different server, I'm using a base href tag in my master page. As many people have discovered, this breaks webform paths. I have a working Form Adaptor class but am not sure how to get the absolute path of the url. Currently, my program is hardcoded to use something akin to : HttpContext Context = HttpContext.Current; value = "http://localhost" + Context.Request.RawUrl; It is worth noting that I'm currently testing on my local IIS server, so there's a strange tendency for a lot of things I've tried using in order what the

Absolute vs Relative Links : Technical Difference

被刻印的时光 ゝ 提交于 2019-12-02 09:26:35
Which is better option or there is no difference in terms of speed or other issues like SEO, Backlinks href="http://www.example.com/contact" href="../../contact" From what i observe, Absolute paths uses paths from left to right finally move to rightmost position as in http//www.example/contact fpr relative paths: first it gets the current location, then based ../../contact or ../blog/articles move there. Technically which is faster, as mentioned in answers speed difference is ignorable/minute. But how it works Jukka K. Korpela There is no (measurable) difference in speed or anything as regards

Checking for relative vs absolute paths/URLs in PHP

Deadly 提交于 2019-12-01 15:23:19
问题 I need to implement functions to check whether paths and urls are relative, absolute, or invalid (invalid syntactically- not whether resource exists). What are the range of cases I should be looking for? function check_path($dirOrFile) { // If it's an absolute path: (Anything that starts with a '/'?) return 'absolute'; // If it's a relative path: return 'relative'; // If it's an invalid path: return 'invalid'; } function check_url($url) { // If it's an absolute url: (Anything that starts with

Issue with PHP include with global path

心已入冬 提交于 2019-12-01 11:40:32
问题 I have been facing an issue with the PHP includes. Based on the readings from internet, I have been using relative path to have the flexibility around. As long as I refer to a path directly in each file, like require_once '../includes/connection.php'; // it works fine. The issue starts when I refer to this path with a global constant require_once getDocumentRoot() . '/includes/connection.php', as it says the below error. Warning: require_once(/phpPractices/myApp/includes/connection.php):

Relative to absolute paths in HTML (asp.net)

瘦欲@ 提交于 2019-12-01 04:26:00
I need to create a newsletters by URL. I to do next: Create a WebClient; Use WebClient's method DownloadData to get a source of page in byte array; Get string from source-html byte array and set it to the newsletter content. But I have some troubles with paths. All elements' sources were relative ( /img/welcome.png ) but I need absolute ( http://www.mysite.com/img/welcome.png ). How can I do this? Best regards, Alex. jo_asakura One of the possible ways to resolve this task is the use the HtmlAgilityPack library. Some example ( fix links ): WebClient client = new WebClient(); byte[] requestHTML

Are protocol-relative URLs relative URLs?

醉酒当歌 提交于 2019-12-01 03:32:35
So consider a protocol-relative URL like so; //www.example.com/file.jpg The idea I've had in my head for as long as I can remember is that protocol-relative URLs are in fact absolute URLs. They behave exactly like absolute URLs, and never do they work like relative URLs. I wouldn't expect this to make the browser go find something at http://www.example.com///www.example.com/file.jpg The URL defines the host and the path (like an absolute URL does), and the scheme is inherited from whatever the page used, and therefore it makes a complete unambiguous URL, i.e. an absolute URL. Right? Now, upon