Crate quad_url[][src]

Expand description


This is the crate to work with URL and open links in miniquad/macroquad environment.

Web demo.


Add this to your Cargo.toml dependencies:

quad-url = "0.1.0"

Usage in WASM

Add file quad-url/js/quad-url.js to your project.

Add file sapp-jsutils/js/sapp_jsutils.js file to your project. (version 0.1.4, compatible with current crate)

Add this lines after loading of gl.js and before loading of your wasm in your index.html:

<script src="sapp_jsutils.js"></script>
<script src="quad-url.js"></script>

Done! Now you can use this crate.


Deletes «command line parameters» in URL. Has no effect outside WASM.

Parses result from get_program_parameters returning (name, value).

Returns string after hash in URL. Returns empty string on non-WASM target.

Function to get «command line parameters» from query string in URL.

If not WASM, then open link in browser. If target is WASM, then link can be opened in the same tab, or in a new tab. But when link is opened in a new tab, browser may block it and ask user permission to do it.

Returns path to current program. Returns just std::env::args().nth(0) for non-WASM. And returns current URL before search params and before hash with full = false, returns full url with full = true.

Set string after hash in URL. Has no effect on non-WASM target.

Set «command line parameters» in URL. Has no effect outside WASM.