Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Base Page URL Regex Matching for Iframe-Loaded Content #1604

Open
radonmiser opened this issue Nov 25, 2024 · 0 comments
Open

Support Base Page URL Regex Matching for Iframe-Loaded Content #1604

radonmiser opened this issue Nov 25, 2024 · 0 comments
Labels
kind/enhancement The issue or PR is a new feature or request

Comments

@radonmiser
Copy link

Description
Add a profile condition that always uses the base page's URL for regex matching. This is useful for readers that load content into an iframe, where the iframe may not have a URL or uses methods like srcdoc. Currently, Yomitan attempts to match the iframe's URL, even if none exists.

For example, in Calibre's content server (with the hack from #499 applied), the library name is presented in the library_id= component of the URL. A user might want to automatically switch profiles—using the English profile for library_id=eng and the Japanese profile for library_id=jpn, etc. However, this doesn't work because Calibre uses srcdoc to load book content, and Yomitan fails to detect the iframe's URL.

Examples

Below is some HTML that demonstrates this behavior.

Yomitan profiles:

Japanese (default)
English (condition: URL regex: "english")

english.html

<body>
    <h1>src="english_content.html"</h1>
    <iframe src="english_content.html" width="300" height="200"></iframe>
    <h1>srcdoc=</h1>
    <iframe srcdoc="<p>English text inside iframe</p>" width="300" height="200"></iframe>
</body>

english_content.html

    <p>English text inside iframe</p>

The english profile condition works on the first iframe but not the second (srcdoc), which mirrors how some readers load content.

Browser version
Firefox

Yomitan version
24.10.7.1

@radonmiser radonmiser added the kind/enhancement The issue or PR is a new feature or request label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement The issue or PR is a new feature or request
Projects
None yet
Development

No branches or pull requests

1 participant