1

I'm making my own website(https://khushit-shah.github.io/) with the help of github.dev.

Now on top of every repository, I wanted to show some content featuring the repository, which should be flexible and easily changeable. So, I created a file in repository named "repodesc.html". which contains the html to we shown!. Then using following code I am adding that html file for every repositories.


var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("{{ repository.id }}").innerHTML =  this.responseText;
    }
};
xhttp.open("GET", "https://raw.githubusercontent.com/khushit-shah/{{ repository.name }}/master/repodesc.html", true);
xhttp.send();

This adds the HTML in https://raw.githubusercontent.com/khushit-shah/Cursor.js/master/repodesc.html to my website(top of Cursor.js). But the script tag in the repodesc is not getting executed.

Code in repodesc.html

<h1 cursor-animate cursor-loop-reverse> Cursor.js </h1>
<script>
  console.log("Is it working?");
  js = "https://raw.githubusercontent.com/khushit-shah/Cursor.js/master/cursor-v.2.0.2.js";
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
   if (this.readyState == 4 && this.status == 200) {
     eval(this.responseText);
   }
  };
  xhttp.open("GET", js, true);
  xhttp.send();
</script>

I even tried repodesc.html


<h1 cursor-animate cursor-loop-reverse> Cursor.js </h1>
<script src="https://cdn.jsdelivr.net/gh/khushit-shah/Cursor.js@latest/cursor.v1.0.0.min.js" >
</script>

expected result : Cursor.js should be executed and the h1 tag should be animated with type writing effect!

actual result: the script in repodesc.html is not getting executed!

Khushit Shah
  • 546
  • 6
  • 20

0 Answers0