I'm making a userscript that requires finding a word related to another word. I found a site where I can go to http://semantic-link.com/#/stack, and there will be a list of words related to stack
in the format of:
<!-- various stuffs here, e.g. <head>, a <div>, another <div>, start of <body> -->
<div id="word0" class="word" onclick="updateTitle("stacks");" style="opacity: 1;">
stacks
</div>
<div id="word1" class="word" onclick="updateTitle("flue");" style="opacity: 1;">
flue
</div>
<div id="word2" class="word" onclick="updateTitle("popped");" style="opacity: 1;">
popped
</div>
<div id="word3" class="word" onclick="updateTitle("overflow");" style="opacity: 1;">
overflow
</div>
In this case, I would want to just get the string stacks
from that page. All of the solutions I have found don't work because they:
- need a custom page,
- use PHP, or
- use
$.ajax()
,$.get()
, or$('something').load()
which are limited to the domain they are executed in.
Is there any way I can get the contents of the #word0
element as a string, using only JavaScript? Alternatively, is there another way to find a word related to another word?