Bromcom Link Extractor

HTML

<h2>Extract Microsoft SSO Link from Bromcom Login Page</h2>
  <button onclick="getLink()">Refresh Link</button>
  
  <h3>Link:</h3>
  <div id="result">Result will appear here...</div>

CSS

body {
      font-family: Arial, sans-serif;
      padding: 20px;
    }
    button {
      padding: 10px 15px;
      font-size: 16px;
      cursor: pointer;
    }
    #result {
      margin-top: 20px;
      font-weight: bold;
      color: blue;
      word-break: break-all;
    }

JavaScript

async function getLink() {
      const resultDiv = document.getElementById('result');
      resultDiv.textContent = "Loading...";

      try {
        const response = await fetch('https://api.codetabs.com/v1/proxy?quest=https://cloudmis.bromcom.com/Nucleus/Framework/Login.aspx');
        const html = await response.text();

        const parser = new DOMParser();
        const doc = parser.parseFromString(html, 'text/html');

        const linkElement = doc.getElementById('btnLinkMicrosoftAccount');

        if (linkElement && linkElement.href) {
          resultDiv.innerHTML = '<a href="' + linkElement.href + '" target="_blank">' + linkElement.href + '</a>';
        } else {
          resultDiv.textContent = "Link not found.";
        }

      } catch (error) {
        resultDiv.textContent = "Error: " + error.message;
      }
    }
	
    document.addEventListener("DOMContentLoaded", () => {
	  getLink();
    });