jidoujisho icon indicating copy to clipboard operation
jidoujisho copied to clipboard

Browser: doesn't detect text inside an iframe

Open TriDyE opened this issue 1 year ago • 5 comments

Good afternoon:

A friend of mine is preparing a web similar to many others multimedia server like Plex or Netflix, but for manga.

It includes the capability to read .html generated using Mokuro and the web will track your current progress, recommend similar manga, track times of reading, ...

When I try to open the web using jidoujisho, your app is not able to read the text inside iframes and because of that, the dictionary doesn't pop up. I can select the text, but the dictionary doesn't work.

The developer told me that the problem is just that: jidoujisho's browser cannot detect text inside iframes.

Can you check if is possible to add the option to read text inside iframes using the browser of jidoujisho?

Thanks!!

TriDyE avatar Jul 26 '23 19:07 TriDyE

You'd just have to edit the JavaScript that I inject into the Browser to make this work. I add a click event handler to the body of the document of a webpage. You'd just have to adjust this to make it so that it works for iframes, though I imagine if there are unrelated CORS issues, that will add some extra complexity to the fix.

arianneorpilla avatar Jul 26 '23 23:07 arianneorpilla

Just for testing purposes, could you please supply a URL that I can use to test against this to make it easier for me to test a fix in the future?

arianneorpilla avatar Jul 26 '23 23:07 arianneorpilla

https://github.com/lrorpilla/jidoujisho/assets/102191690/32218730-b546-4092-a96c-aad38faf6f90

Good morning:

I don't know any URL that uses iframes right now, sorry. Only the web of my friend.

Also I was talking with my friend and he told me that you only need to create a web and add this to create an iframe and test:

He cannot grant you access to his web right now cause is a project for university and its not finished yet, sorry. I'm only a helper and beta tester.

I recorded a video about this problem. It's attached to this reply.

Thanks for your work!!

TriDyE avatar Jul 27 '23 10:07 TriDyE

You'd just have to edit the JavaScript that I inject into the Browser to make this work. I add a click event handler to the body of the document of a webpage. You'd just have to adjust this to make it so that it works for iframes, though I imagine if there are unrelated CORS issues, that will add some extra complexity to the fix.

Hello, I am the friend 😂, by "adjust the event handler" you mean to create a pull request with the changes? because as far as I know there is no way to modify code injected by the browser.

I got the app to recognize the text inside the iframe by replacing the getSelection function in my website, but I don't think I can do anything about the event listener. I cloned the click event from the iframe and triggered it in the parent, but the app won't find text because it searches for it in the parent document.

Thanks

alexay7 avatar Jul 27 '23 12:07 alexay7

That is the case, yeah. Truth be told, the browser was a popular request, one that I don't use myself regularly but I see the benefits for. I was initially hesitant exactly for the reason being web is web and there are a lot of edge cases out there.

I don't have time at present to make the changes myself as while this is a pretty significant issue, it's also not really very common (though it is also not super rare, it's also not a media source I commonly use).

Plain JavaScript isn't my forte suffice to say but I'll leave this open for the web devs, or me sometime when I'm not pressed with work lol

arianneorpilla avatar Jul 27 '23 12:07 arianneorpilla