Differences
This shows you the differences between two versions of the page.
— |
241:viewer:sdk:examples_js:autologin_publisher_publicationselect [2024/04/12 08:45] (current) pieter created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Example: Autologin to a Publisher using Credentials (no pre-selected publication) | ||
+ | On startup, the user is automatically logged in, but can still choose which publication to open. | ||
+ | |||
+ | < | ||
+ | < | ||
+ | let exampleUrl = " | ||
+ | </ | ||
+ | |||
+ | <link rel=" | ||
+ | integrity=" | ||
+ | crossorigin=" | ||
+ | |||
+ | <script src=" | ||
+ | integrity=" | ||
+ | crossorigin=" | ||
+ | |||
+ | <span id=" | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <input type=" | ||
+ | <span id=" | ||
+ | |||
+ | < | ||
+ | |||
+ | let toggleShowSource = () => { | ||
+ | let element = document.getElementById(" | ||
+ | element.style.display = element.style.display == ' | ||
+ | } | ||
+ | |||
+ | fetch(exampleUrl) | ||
+ | .then(response => response.text()) | ||
+ | .then(text => { | ||
+ | |||
+ | try { | ||
+ | // add example in iframe | ||
+ | let frame = document.createElement(" | ||
+ | frame.style.border = ' | ||
+ | frame.style.overflow = ' | ||
+ | frame.width = 950; | ||
+ | frame.height = 420; | ||
+ | frame.srcdoc = text; | ||
+ | document.getElementById(" | ||
+ | |||
+ | // add ' | ||
+ | let pre = document.createElement(" | ||
+ | pre.classList.add(" | ||
+ | pre.classList.add(" | ||
+ | pre.textContent = text; | ||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | document.getElementById(" | ||
+ | |||
+ | // highlight | ||
+ | hljs.highlightBlock(pre); | ||
+ | |||
+ | } catch (error) { console.error(error); | ||
+ | |||
+ | }); | ||
+ | |||
+ | </ | ||
+ | |||
+ | </ |
Last modified:: 2024/04/12 08:45