diff --git a/src/mol-util/url-query.ts b/src/mol-util/url-query.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4a10a8371c24b55995ea175df35fb14bc6cec86 --- /dev/null +++ b/src/mol-util/url-query.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. + * + * @author Alexander Rose <alexander.rose@weirdbyte.de> + */ + +export function urlQueryParameter (id: string) { + if (typeof window === 'undefined') return undefined + const a = new RegExp(`${id}=([^&#=]*)`) + const m = a.exec(window.location.search) + return m ? decodeURIComponent(m[1]) : undefined +} \ No newline at end of file