问题
I'm using the X_ITE javascript-WebGL library to display a legacy VRML project in modern browsers.
Anchors in the VRML code currently open HTML files in separate windows (on the same domain) like this:
Anchor {
url "javascript: window.open('./data/583.html' other_stuff…)"
description etc.…
}
or by calling a function and passing the relevant argument:
url "javascript: showInfo('583')"
Both produce CORS errors, which I can get around by simply opening the URL:
url "data/583.html"
However, instead of a "back" link from that page to the model (and page reload) I want to present the content in a modal (or something) on the same HTML page, but the CORS issue remains even with a simple call to console.log()
:
url "javascript: console.log('hello');
What would be the best approach to this? The codebase is here and here's the file I'm looking at.
Ideally, I'd like to know if it's possible to add an event listener to a VRML element as you can in X3D? If not, how do I handle the CORS issue with url "javascript: …
?
来源:https://stackoverflow.com/questions/60027233/how-can-i-trigger-javascript-in-a-vrml-anchor-is-it-possible-to-use-an-event-lis