I am trying to develop a chrome extension (zero experience) using webserver API to get tiddler status.
My purpose is to display an icon/link in the literature page if it is already managed by TW/refnotes through
DOI
. Is there any existing tools for this purpose?
My tiddlywiki is configured under node.js with TW 5.3.3.
However I cannot call fetch
function for any GET
request. Below is my minimum example of html/js scripts for demonstration purpose.
<html>
<body>
<script>
async function gettiddler() {
fetch("http://localhost:8080/recipes/default/tiddlers/test",{
method: "GET",
mode: 'cors',
headers: {
"Content-Type": "application/json",
'Accept': 'application/json',
"x-requested-with": "TiddlyWiki",
"Access-Control-Allow-Origin":"*"
}
})
.then((response) => response.json())
.then((json) => console.log(json));
}
gettiddler();
</script>
</body>
</html>
I have played with headers
and mode
parameters with different combinations and always get CORS error
.
I believe the GET
request in TW should not check CORS
according to documentation.
Thanks for any suggestions.