Comments (14)
Hi Hinko!
You can define a url or a file rleative location as browser hash.
Here is an example:
http://3dviewer.net#https://cdn.rawgit.com/kovacsv/Online3DViewer/9e9ca71d/website/testfiles/cube.3ds
Regards,
Viktor
from online3dviewer.
Local file access will never work because of browser security restrictions. Image how big security hole would be if a browser could access any file on your computer. Drag and drop and file open works because in these cases you explicitly stated you want to allow the website to access your file.
If you want to use the viewer for local files you can do this:
- Download the repository.
- Go to the website folder.
- Copy 3D files into this folder, on in a subfolder.
- Now it should work offline with a url like this:
file:///C:/Online3DViewer/website/index.html#testfiles/cube.3ds
This solution works only in Firefox. If you would like to use Chrome, you have to install a web server on your computer.
from online3dviewer.
Works great .. thanks!
from online3dviewer.
Hi Viktor,
Really nice work.
Just one question:
how to use browser hash to open multiple files for obj format?
Thanks,
Yuzhang
from online3dviewer.
Unfortunately it is not possible at the moment to show multiple files.
from online3dviewer.
I would recommend to add this example or at least a hint to the README.
I also tried a lot of url schemes before even reading the README (e.g. the page contains an element <input id='file' ...>
so I assumed a ?file=...
.
It's not very common to use a hash #
.
I would also add a comment, why it is hash. I assume it's a hash because the page doesn't reload when switching to a relative url of the format #url
.
from online3dviewer.
Thanks for the idea, I added an example in the dev branch, so it will be available soon. I've called it location hash because this is the name of it: https://www.w3schools.com/jsref/prop_loc_hash.asp :)
from online3dviewer.
it's also very difficult today, because of all those security related restrictions.
I couldn't convince Firefox or Chrome to load a local file://... URL after the hash.
I cannot really understand why, because drag and drop or file selection works. I assume the permissions are different in these cases?
I also tried everything from https://www.viewstl.com/local_url/
I guess you should add something like this to your docs or simply a reference to that page.
However, it didn't help me.
Note, I always use the most recent versions of these browsers (FF=nightly 66.0a1, chrome=stable 71.0.3578.98)
I also tried other browsers like Midori, Falkon etc., but they either use the same security model or they lack support for the necessary 3D features etc.
from online3dviewer.
there are a lot of tips to workaround this, I tried these:
google-chrome --disable-web-security "https://3dviewer.net#$url"
google-chrome --allow-file-access-from-files --allow-file-access --allow-cross-origin-auth-prompt "https://3dviewer.net#$url"
chromium --disable-web-security "https://3dviewer.net#$url"
chromium --disable-web-security "http://www.viewstl.com/viewstl.php?url=$url"
chromium --allow-file-access-from-files --allow-file-access --allow-cross-origin-auth-prompt "https://3dviewer.net#$url"
chromium --out-of-blink-cors "https://3dviewer.net#$url"
however with current browsers this didn't work. But I am sure it worked some time ago.
I created a little electron app and got it to load the file. But it's not completely ready yet...
from online3dviewer.
I once tried it with a local 3dviewer (loaded via file://) but it didn't work.
But that was before knowing the command line options mentioned above.
After testing several combinations of these options, I need only one to load local files from a viewer loaded from local files:
chromium --allow-file-access-from-files "file:///z/3D-print/Online3DViewer/website/index.html#file:///z/3D-print/things/test/test-jscad/output.stl"
So my first requirement is satisfied.
Now I need to figure out how to autoload the stl file while ideally keeping all view parameters like angles, zoom factor, etc.
In general this should work with a relative hash url. But how to set it on the existing tab?
from online3dviewer.
Does using the hash only works with .3ds file. I tried uploading Stl file from Amazon or from my local server but both failed. Error "No readable file found You can only open 3ds, obj, Stl and off files". The files work in drag and drop thou. What do you think?
from online3dviewer.
Seems working for me: http://3dviewer.net/#https://cdn.rawgit.com/kovacsv/Online3DViewer/9e9ca71d/website/testfiles/objects_ascii.stl
Can you send the link what doesn't work for you?
from online3dviewer.
Working will all the other formats locally but I can't get it to work from Amazon S3. Looking at your URL, there are no dashes. My amazon URL is ''https://stltestingw.s3-us-west-2.amazonaws.com/3Dimplantfilestl.stl''
from online3dviewer.
I think it is a cross origin request issue. You have to allow CORS on your server.
from online3dviewer.
Related Issues (20)
- Rhino Export Hangs: "s.materials().count is not a function" HOT 2
- feat: support i18n
- Hello there
- Use CDN for third-party libraries HOT 5
- Use CDN for web-ifc
- Loading FCStd model hangs without throwing an error HOT 2
- The page is not loading HOT 13
- load STEP : The model doesn't contain any meshes HOT 1
- Possible to change the SVG icon ? HOT 1
- Apple Vision Pro support
- How to add help button or add website plugin HOT 2
- stp:Failed to import model. The model doesn't contain any meshes. HOT 2
- Mesh edges display error HOT 3
- occt-import-js fetched each time from the CDN HOT 4
- Deployment issue HOT 1
- e.Clone not a function error
- Use perferred user color scheme if not cookie was found
- USDZ support
- too many ads on the website HOT 2
- How to use the point measurement in the JS library HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from online3dviewer.