url-fragment

How do I get the fragment identifier (value after hash #) from a URL?

感情迁移 提交于 2020-01-08 11:11:39
问题 Example: www.site.com/index.php#hello Using jQuery, I want to put the value hello in a variable: var type = … 回答1: No need for jQuery var type = window.location.hash.substr(1); 回答2: You may do it by using following code: var url = "www.site.com/index.php#hello"; var hash = url.substring(url.indexOf('#')+1); alert(hash); SEE DEMO 回答3: var url ='www.site.com/index.php#hello'; var type = url.split('#'); var hash = ''; if(type.length > 1) hash = type[1]; alert(hash); Working demo on jsfiddle 回答4:

How do I get the fragment identifier (value after hash #) from a URL?

假如想象 提交于 2020-01-08 11:11:34
问题 Example: www.site.com/index.php#hello Using jQuery, I want to put the value hello in a variable: var type = … 回答1: No need for jQuery var type = window.location.hash.substr(1); 回答2: You may do it by using following code: var url = "www.site.com/index.php#hello"; var hash = url.substring(url.indexOf('#')+1); alert(hash); SEE DEMO 回答3: var url ='www.site.com/index.php#hello'; var type = url.split('#'); var hash = ''; if(type.length > 1) hash = type[1]; alert(hash); Working demo on jsfiddle 回答4:

Escaped # in URLs, sitemap and handling by Google crawler

陌路散爱 提交于 2019-12-07 14:24:50
问题 We have a large set of URLs of which some contain a hash character. The hash is not to indicate a fragment, but part of the URL path, so we escape the hash by %23 , e.g. http://example.com/example%231 http://example.com/another-example%232 … Our sitemap.xml lists these URLs as follows: <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://example.com/example%231</loc> </url> <url> <loc>http://example.com/another-example%232</loc> </url> <!-- and so on … --> </urlset>

Escaped # in URLs, sitemap and handling by Google crawler

拈花ヽ惹草 提交于 2019-12-06 03:57:00
We have a large set of URLs of which some contain a hash character. The hash is not to indicate a fragment, but part of the URL path, so we escape the hash by %23 , e.g. http://example.com/example%231 http://example.com/another-example%232 … Our sitemap.xml lists these URLs as follows: <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://example.com/example%231</loc> </url> <url> <loc>http://example.com/another-example%232</loc> </url> <!-- and so on … --> </urlset> Now, the Google Search Console reports 404 errors for the following URLs: http://example.com/example

How do I get the fragment identifier (value after hash #) from a URL?

点点圈 提交于 2019-11-26 10:20:50
Example: www.site.com/index.php#hello Using jQuery, I want to put the value hello in a variable: var type = … No need for jQuery var type = window.location.hash.substr(1); You may do it by using following code: var url = "www.site.com/index.php#hello"; var hash = url.substring(url.indexOf('#')+1); alert(hash); SEE DEMO var url ='www.site.com/index.php#hello'; var type = url.split('#'); var hash = ''; if(type.length > 1) hash = type[1]; alert(hash); Working demo on jsfiddle Use the following JavaScript to get the value after hash (#) from a URL. You don't need to use jQuery for that. var hash =