-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get a black screen even with simple example codes #109
Comments
Please try to load the Deer.x3d file without x_ite_dom.js first as shown here: https://create3000.github.io/x_ite/#embedding-x_ite-within-a-web-page [Also, the X3D.html file is actually an .xhtml file, not an .html file. You would need to rename it to .xhtml so the web browser can recognize it properly.] |
Hi Andreas! Thank you so much for the quick answer. I got the same behavior with the following file (created according to your comment). I had to add "xmlns="http://www.w3.org/1999/xhtml" to the first line to make browser understand the XHTML extension. Could you try it at your end? Thanks :) |
https://jsitor.com/brwY2dVy3 works fine. |
What is your file structure? I'm just keeping all files in the same directory. Tried different browsers. Tried with html and xhtml extensions (for the latter I had to add "xmlns="http://www.w3.org/1999/xhtml" to the HTML tag so the browser could read it) Thanks for the help! |
You need a server. A live web page will be necessary to further debug. You could try github pages. |
I just wanted to display local X3D and VRML files in a browser. I'm working on a project where these files come from a local application and I would create an HTML report with these results, and the web page would display these 3D geometries . Is that even possible? Sorry for the confusion and appreciate any help :) |
Yes. that should be possible. Even for local files, you will need a simple http server. Python comes with one: https://doc.x3dom.org/gettingStarted/pythonSimpleHTTP/index.html Other options: https://create3000.github.io/x_ite/#using-firefox-chrome-and-opera-with-local-files |
Please open the Developer Console of your browser and and look/post what output is there. |
You can use relative paths, when the x3d is in the same folder as your html, you then only need |
I tried this in first place, it didn't work, that's why I tried with the server, after Andreas suggestion...
It looks like it can't load "Deer.x3d" but if I paste the same link on the browser it works fine. |
If I use a slightly different syntax (based on another example I got from "https://andreasplesch.github.io/x_ite_dom/index.xhtml"), the error changes a bit, and the behavior goes back to my first report, where the screen is black. See new syntax and error below: These are the links I'm calling |
Try without x_ite_dom.js first. But the cors error is unrelated. I think Holger suggested to try relative urls with the server running. I think it should work with the full url. Perhaps the nonstandard port ? Unlikely, but you can quickly try: I think there chrome extensions for allowing cors. |
Here is a Chrome CORS extension https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf It could be that with this extension file:// protocol works, not tested yet. |
So, using local files directly won't work, it will complain it needs to be an http. If I call the local files using the http from the local server, I get a bunch of 404 errors: I suppose I need other files besides x_ite.js, x_ite_dom.js and x_ite.css? PS: tried different port, also enable this CORS extension but didn't made a difference... |
You need to enable CORS see https://stackoverflow.com/questions/21956683/enable-access-control-on-simple-http-server use the checked answer, section "Python 3 solution", OR install a Chrome extension to enable CORS https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf. |
It seems that it cannot be solved easily your localhost server problem. First of all, you need this localhost server, make sure your server is running properly, try simple html pages with local images. Search the Internet for how to setup a localhost server. Make sure everything is in the right folder. Try using the IP address 127.0.0.1, this is the address for the name "localhost", it can be that the computer tries to resolve the name localhost in an Internet IP address. Google that problem. |
Hello Holger, Andreas, First of all, I'd like to stress my appreciation for the help. Having this 3D images showing in the browser is a key aspect of my project. I'll try to summarize all I'm doing so hopefully you can see a mistake.
I have created a screen recording and you can see it, and all files I'm using, in the attached file. Could you please review the screen recording and files? I'm pretty sure the error should be something really dumb from my side, because the interface seems to be loading correctly. Thanks again! |
I can now reproduce the bug from the image, and as you say the answer is quite simple. X_ITE is not only the .js and the .css it is a folder with files (The files which are not found). The complete folder can be downloaded at https://create3000.github.io/x_ite/#download-x_ite (Download ZIP archive), you need to unpack the ZIP first. But wait, better use the remote urls (huuu, hopefully it works for you, but you can always try the ZIP folder): <link rel="stylesheet" type="text/css" href="https://create3000.github.io/code/x_ite/latest/dist/x_ite.css"/>
<script type="text/javascript" src="https://create3000.github.io/code/x_ite/latest/dist/x_ite.min.js"></script>
<script type="text/javascript" src="https://raw.githack.com/andreasplesch/x_ite_dom/master/release/x_ite_dom.1.3.js"></script> Another mistake is that the <Inline DEF="usedDeer" url='"http://localhost:8000/Deer.x3d"'></Inline> Besides this you have put a DIV element with and IMAGE inside the HEAD element, this is not legal. Layout elements must be inside the BODY element. Only SCRIPT and LINK like stuff are content for the HEAD element. I fixed your X3D.html, please try this. |
THANK YOU!!! Worked perfectly with the urls. I could even open my wrl file which was my primary goal! Looks like the http server is really needed since pointing to directly to a file wont work. But anyways, thank you so much for the help, now I can study more the examples and docs about X_ite to improve my project. Have a great weekend! |
FWIW for playing with vrml, i use firefox and set; security.fileuri.strict_origin_policy="false" (accessed in "about:config") but.... this way local files are only loadable from a sub-directory. |
Just for documentation: I just added a commit that fixes this problem when CORS is disabled in the web browser's setting, then even file:// protocol will work with X_ITE. |
Firefox: about:config -> security.fileuri.strict_origin_policy -> false |
Hi, |
@zzarkov Do you still have the problem? |
Hi Holger,
No, it is ok now at least for myself, I have no one to test it. Shortly
after my message the problem was gone
by itself, I did nothing about it. I guess it was a new version of X_ITE.
Thanks for the reply,
Zlatomir
PS. Is there some example code on how to use X_ITE and Electron?
…On Fri, Aug 4, 2023 at 2:43 AM Holger Seelig ***@***.***> wrote:
@zzarkov <https://github.com/zzarkov> Do you still have the problem?
—
Reply to this email directly, view it on GitHub
<#109 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACM42KXGEE4JBWL33NEYACDXTRAULANCNFSM5SGI2SYA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
--
Zlatomir Zarkov
http://www.vrinternal.com/
|
I have opened a new issue for that topic, how to use X_ITE and Electron? |
Describe the bug
First off, congrats on the great tool! I'm sorry for the noob question, just started working with X_ITE + HTML today. I know a little about Python and little about HTML, so I I'm having a hard time. Hopefully this means my question is easy to solve :)
Is summary: I'm trying to open a .x3d geometry in any browser an manipulate it. This should be the absolute most simple code but unfortunately it is not working for me. When I open my HTML I only see a black screen, although if I right click the viewer area I can see the commands appear:
I am attaching the files I'm using, appreciate any help. My code was based in one of the examples available at https://andreasplesch.github.io/x_ite_dom/index.xhtml
As a side note, my final objective would be to open a VRML file in the browser, would that be possible?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A black screen will show up.
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Not tested
Additional context
Again, I'm sorry for the noob question, didn't find anywhere else I could ask this question...
X_ITE_sample.zip
The text was updated successfully, but these errors were encountered: