← All examples

JavaScript Navigation scholar.google.com

Scholar: direct "My profile" shortcut

When you are logged in, adds a top-bar link that goes straight to your Scholar profile page.

Code to copy

// Add a direct "My profile" link in the top bar when logged in
(function () {
  if (document.getElementById('jzSchProf')) { return; }
  function mount() {
    var host = document.querySelector('#gs_hdr_drw, #gs_hdr_act, #gs_top');
    if (!host) { return; }
    var loggedIn = document.querySelector('a[href*="SignOutOptions"], a[href*="logout"], #gs_hdr_drw a[href*="/citations?"]');
    if (!loggedIn) { return; }
    if (document.getElementById('jzSchProf')) { return; }
    var a = document.createElement('a');
    a.id = 'jzSchProf';
    a.href = '/citations?hl=en&user=me';
    a.textContent = 'My profile';
    a.style.cssText = 'display:inline-block;margin:6px 10px;padding:6px 12px;background:#0a7c3a;color:#fff;font-size:13px;font-weight:700;text-decoration:none;border-radius:4px;';
    host.appendChild(a);
  }
  mount();
  new MutationObserver(function () {
    clearTimeout(window.__jzSchProf);
    window.__jzSchProf = setTimeout(mount, 400);
  }).observe(document.body, { childList: true, subtree: true });
})();

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Paste the code into the rule's JavaScript panel and save — it runs on every page visit.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases