Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Categories

yEd Live: open file with parameter?

0 votes
Hi, Is it possible to pass a URL of a GraphML file to yEd Live to open the file automatically in yEd Live via a hyperlink?
in Help by (120 points)

1 Answer

0 votes

Yes, it is possible to pass a URL of a GraphML file to yEd Live to open the file automatically.

The format for directly loading graphs via URL is https://www.yworks.com/yed-live/#file=URL where URL is, well, the URL of the GraphML file you want to open.

Be aware that the file must be cross origin accessible (i.e. Access-Control-Allow-Origin: * must be set on the response's file header).
For instance, this works for files shared by a public link via Dropbox while shared links of Google Drive and OneDrive are more restrictive.

by [yWorks] (161k points)
Hi Thomas, I have enabled CORS for .graphml files on our server by adding
    
<IfModule mod_headers.c>
    <FilesMatch "\.(graphml)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

to .htaccess  but I am still having trouble getting them to load in yEd live. After confirming Trusted Source in the dialog, yEd live displays an error dialog:

"ErrorClose
Couldn't load the given URL. This may due to a cross origin error or the given URL does not link to a GraphML file:

http://www.virtuallyimmune.org/test.graphml"

The URL that I am using to open yEd live is https://www.yworks.com/yed-live/#file=http://www.virtuallyimmune.org/test.graphml

I have confirmed that CORS has been enabled using:

curl -H "Origin: http://yworks.org" --verbose http://www.virtuallyimmune.org/test.graphml

Could you provide a working example of a GraphML file on a server, which can be opened via URL in yEd Live?
In addition to CORS, the security policies of modern browsers also restrict/block so-called "mixed content," i.e. they prevent loading of HTTP content in a page served with HTTPS.
The message in the error dialog doesn't make this terribly clear, though. I guess, there is some room for improvement in this respect.

That said, if you can serve your GraphML file with HTTPS, all should be fine. For an example of a GraphML file served with HTTPS that's working just fine, try this one:
https://dl.dropboxusercontent.com/s/nrmro4cfi98vmcg/movies.graphml
Hi Thomas, I eventually got this to work. Thanks for your help.

I found that in order to get my .graphml file to open in yEd Live, I had to edit .htaccess to set the MIME type of .graphml files to text/plain
(I tested your file with curl -I https://dl.dropboxusercontent.com/s/nrmro4cfi98vmcg/movies.graphml to look at the headers and Dropbox serves it as text/plain).

Previously, the MIME type of my file had been set to application/graphml+xml, which I believe is the correct MIME type for .graphml files. This MIME type seems to stop the file opening in yEd Live, however.
Thank you for pointing us to the problem. As you have noticed, the import can only handle plain text files.
Currently, the URL loading just assumes that the incoming file is a plain text and therefore tries to import it as such. I have added an issue to make the import also work for actual GraphML documents in the future.
Legal Disclosure | Privacy Policy
...