Skip to content

Enable custom URLs for clipboard copy workaround#1189

Merged
nrichers merged 2 commits intomainfrom
nrichers/sc-14935/enable-custom-urls-for-clipboard-copy-workaround
Feb 27, 2026
Merged

Enable custom URLs for clipboard copy workaround#1189
nrichers merged 2 commits intomainfrom
nrichers/sc-14935/enable-custom-urls-for-clipboard-copy-workaround

Conversation

@nrichers
Copy link
Collaborator

@nrichers nrichers commented Feb 27, 2026

Pull Request Description

What and why?

The rewriteUrls() function in vmurl-settings.js rewrites URLs in:

  • section[data-background-iframe] attributes (background iframes)
  • a[href] attributes (links)

But the function does not rewrite iframe[src] attributes, so the hardcoded URLs in _get-your-code-snippet.qmd and _retrieve-your-code-snippet.qmd are never updated when users set a custom URL.

This PR adds iframe src rewriting to the rewriteUrls() function, following the same pattern as existing rewrites.

How to test

  • Set a custom ValidMind URL via the settings modal
  • Verify code snippet iframes load from the custom URL on pages that use the workaround

Proof it works:

The custom URL is set to https://app.dev.vm.validmind.ai/, pointing to our dev environment instead of prod.

A page that embeds _get-your-code-snippet.qmd:

  • The address bar shows this is a page where we use the workaround
  • Inspection shows the iframe points to https://app.dev.vm.validmind.ai/
Capto_ 2026-02-27_12-57-59_pm

A page that embeds _retrieve-your-code-snippet.qmd:

  • The address bar shows this is a page where we use the workaround
  • Inspection shows the iframe points to https://app.dev.vm.validmind.ai/
Capto_ 2026-02-27_01-23-53_pm

What needs special review?

N/A

Dependencies, breaking changes, and deployment notes

None

Release notes

N/A — internal training slides update

Checklist

  • What and why
  • Screenshots or videos (Frontend)
  • How to test
  • What needs special review
  • Dependencies, breaking changes, and deployment notes
  • Labels applied
  • PR linked to Shortcut
  • Unit tests added (Backend)
  • Tested locally
  • Documentation updated (if required)
  • Environment variable additions/changes documented (if required)

@github-actions
Copy link
Contributor

Pull requests must include at least one of the required labels: internal, highlight, enhancement, bug, deprecation, documentation. Except for internal, pull requests must also include a description in the release notes section.

@nrichers nrichers added internal Not to be externalized in the release notes bug Something isn't working labels Feb 27, 2026
@nrichers nrichers requested a review from validbeck February 27, 2026 21:37
Copy link
Collaborator

@validbeck validbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked after I did the Developer Tools > Empty Cache & Hard Reload thing, before it gave me this:

Image Image

So to user-proof this, I added commit #8eb6376 which does the emptying & hard-refreshing when users click the refresh page button.

@github-actions
Copy link
Contributor

Lighthouse check results

⚠️ WARN: Average accessibility score is 0.87 (required: >0.9) — Check the workflow run

Show Lighthouse scores

Folder depth level checked: 0

Commit SHA: 65c9bfc

Modify the workflow to check a different depth:

  • 0: Top-level navigation only — /index.html, /guide/guides.html, ...
  • 1: All first-level subdirectories — /guide/.html, /developer/.html, ...
  • 2: All second-level subdirectories — /guide/attestation/*.html, ...
Page Accessibility Performance Best Practices SEO
/developer/validmind-library.html 0.85 0.66 1.00 0.82
/get-started/get-started.html 0.85 0.61 1.00 0.73
/guide/guides.html 0.85 0.68 1.00 0.82
/index.html 0.93 0.65 1.00 0.82
/releases/all-releases.html 0.86 0.71 1.00 0.73
/support/support.html 0.91 0.61 1.00 0.82
/training/training.html 0.85 0.66 0.96 0.73

@github-actions
Copy link
Contributor

PR Summary

This PR introduces two primary enhancements:

  1. In the file site/training/assets/vmurl-settings.js, the URL rewriting logic has been extended to handle iframe elements. The script now selects iframes whose src attribute contains "app.prod.validmind.ai" and rewrites them using a custom URL. This ensures that iframes are updated in the same fashion as other elements on the page.

  2. In the login slide pages (_log-in-with-jupyterhub.qmd and _log-in.qmd), the page refresh mechanism has been improved. Rather than using window.location.reload(), the refresh button now sets window.location.href to the current pathname with an appended query parameter (?nocache=timestamp). This approach forces a fresh fetch of the page content by circumventing potential browser caching issues.

Test Suggestions

  • Test that iframes with src attributes containing 'app.prod.validmind.ai' are correctly updated with the custom URL.
  • Click the refresh button to ensure that the page reloads with a new 'nocache' timestamp appended to the URL, bypassing the cache.
  • Verify that other URL rewriting functionalities (e.g., for anchor links) remain unaffected.
  • Perform cross-browser tests to confirm consistent behavior of the new refresh mechanism and iframe URL rewriting.

@github-actions
Copy link
Contributor

Validate docs site

✓ INFO: A live preview of the docs site is available — Open the preview

@nrichers
Copy link
Collaborator Author

So to user-proof this, I added commit #8eb6376 which does the emptying & hard-refreshing when users click the refresh page button.

Thank you, @validbeck! I did not see this behaviour but I appreciate you adding a nocache directive to help our users. 🫶

@nrichers nrichers merged commit e41a3f9 into main Feb 27, 2026
6 of 8 checks passed
@nrichers nrichers deleted the nrichers/sc-14935/enable-custom-urls-for-clipboard-copy-workaround branch February 27, 2026 22:54
nrichers added a commit that referenced this pull request Feb 27, 2026
* Enable custom URLs for copy-clipboard workaround

* Empty cache & hard refresh on login pages

---------

Co-authored-by: Beck <164545837+validbeck@users.noreply.github.com>
nrichers added a commit that referenced this pull request Feb 27, 2026
Cherry pick: Enable custom URLs for clipboard copy workaround (#1189)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working internal Not to be externalized in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants