Is Ajax Deep Linking possible without adding hashes ('#') in links

Most of the jquery deep linking plugins I've seen require me to attach a "#" to my links. That's an example:

<a href="#page1.html">Page 1</a>

Even twitter does this (however, Twitter follows the Google specification for crawlable links with help #!, which is also supported by jQuery deep library links such as jQuery BBQ and jQuery Address).

I disabled Javascript with a new twitter and it does not work. I ask this question to find out if I can apply a deep link and still have a functional site even with Javascript disabled.

Thanks in advance!

+3
source share
3 answers

- AJAX, . URL-, ​​ . , .

, , a, jQuery :

<a href="page1.html" class="ajaxLoad">Page 1</a>

<script>
$(function(){
  $("a.ajaxLoad").each(function(){ this.href = '#' + this.href })
});
</script>

JavaScript , _1.html, . , . - , , JavaScript, ( ).


: , , , JavaScript . , load - , .

$("a.ajaxLoad").click(function(e){
    e.preventDefault();
    $("#content").load(this.href + ' #content');
});
+3

HTML5. History.js.

HTML5, , HTML4 ( , ).

History.js .

+5

Anchor is the only part that can be changed without a complete page reload. Therefore, by definition, you have no other way. In addition, by definition, the anchor is not passed to the server, so when javascript is turned off, this obviously will not work.

+2
source

Source: https://habr.com/ru/post/1784483/


All Articles