Skip to content
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

Return HTML/JavaScript in POIs. #1313

Open
TransportLayer opened this issue Jul 9, 2016 · 3 comments
Open

Return HTML/JavaScript in POIs. #1313

TransportLayer opened this issue Jul 9, 2016 · 3 comments

Comments

@TransportLayer
Copy link

This is a feature request. Currently, you can return strings in POIs/markers, and HTML seems to work fine. However, JavaScript does not load or execute.

In testing, I cannot get any JavaScript to execute through <script> tags with the code returned from within Python (example: <script> console.log("Test");) or from another source (via <script src=...>). The code is visible if you view the page source in-browser or through the browser's developer tools, but nothing executes (in the example, the message does not show up in the console), however the code is (as expected) hidden from the user otherwise.

If this could be fixed, that would open up many possibilities for more custom map markers/POIs.

I thank you for your time.

@CounterPillow
Copy link
Member

It'd probably be best to simply include those scripts using custom web assets.

@TransportLayer
Copy link
Author

Unless it is just because of my limited knowledge of web development (if so, please let me know and I will do further research), I am unsure if using custom web assets would be as powerful as I'd like it to be.

My specific use of returning HTML/JS is to render player inventories with all of their items (including custom names, enchantments) and chest contents so viewers of the map can click on a player or chest and easily view its contents. I wrote the code to do this (with HTML5 Canvas + JavaScript), but getting it to display on the map/outside of a test webpage is where I am stopped.

@CounterPillow
Copy link
Member

You should put the canvas DOM inside the poi, but include the JS scripts in custom web assets, probably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants