I'm building an in-game browser RoR app for Eve Online. One of the requirements of my app is displaying an SVG graph generated by graphviz. I'm having some issues getting my requirements met within this environment.
No official documentation is available for Eve's IGB, but the wiki indicates:
The new EVE Online in-game browser (code-named Moondoggie) is based on a technology stack combining two elements:
Awesomium: A middleware layer that delivers rendered webpages as data parseable by a 3D engine. Awesomium is developed by Khrona Software.
Chromium: A middleware layer that provides interprocess communication, webpage rendering, HTTP communications, and all the other basics needed for writing a web browser. It is, itself, based on Apple’s Webkit framework. Chromium is an open-source project championed primarily by Google.
Because of this, Moondoggie is able to pass the Acid3 test and thus can support the full HTML 4.01 and CSS3 specifications.
I need the links I'm including in the SVG to have access to my app's javascript. Embedding it with <embed>
or <object>
puts the SVG out of the scope of my JS files.
Using <embed>
or <object>
DOES render the svg properly within the in-game browser. When it is inline like I have it below, it displays one line of text containing JUST the text elements from the SVG.
Update
Here's where I'm at. I'm pretty sure most of this is redundant, as I didn't notice a difference by just using the render file:
inside my view on its own. I think the mime type registration is more for use with respond_to, but I'm not really sure how to use that in this scenario.
snippet of main view:
<%= render "map/map" %>
partial view file:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg">
<head>
<title>Embedded SVG</title>
</head>
<body>
<%= render file: @map.output_file_path %>
</body>
</html>
config/initializers/mime_types.rb:
Mime::Type.register "image/svg+xml", :svg
I don't understand why it renders fine inside an <object>
tag but not when inline. How do I emulate the environment inside an <object>
in my main view? Or, how can I give the <object>
tag access to my javascript functions?
It is possible to access the document inside an <object> or <embed> from the parent document. This is one of the (way too few) svg things ACID3 still tests.
Here's an example of how to modify an svg document from a script in the parent html document.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With