You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2021. It is now read-only.
injected.jsonly gets injected in the top-level page, not in iframes. This means that the functionality it provides is not available inside iframes.
So, these are missing (at least):
long-press menu: The default/native webview long-press menu is shown, rather than the custom menu. The items on it aren't wired up properly, so they either do nothing or behave oddly.
target="_blank" handling: Links with that property will not open in a new tab.
We played with injecting injected.js at every level (top and frames). It fixes the target="blank" problem, but the long-press menu problem remains. This is because when the ObjC function elementsAtLocationFromGestureRecognizer calls the JS function elementsAtPoint, it will only ever call the top-level page's function (because that's how stringByEvaluatingJavaScriptFromString works). So elementsAtPoint would have to do something like: detect that the given coordinates are inside an iframe, change the coordinates to be relative to the frame's location, communicate with the frame (probably via postMessage) to get it to call elementsAtPoint, and then report back to the ObjC. (In addition to the other complications, this will go from being a synchronous call to async.)
injected.js
only gets injected in the top-level page, not in iframes. This means that the functionality it provides is not available inside iframes.So, these are missing (at least):
target="_blank"
handling: Links with that property will not open in a new tab.We played with injecting
injected.js
at every level (top and frames). It fixes thetarget="blank"
problem, but the long-press menu problem remains. This is because when the ObjC functionelementsAtLocationFromGestureRecognizer
calls the JS functionelementsAtPoint
, it will only ever call the top-level page's function (because that's howstringByEvaluatingJavaScriptFromString
works). SoelementsAtPoint
would have to do something like: detect that the given coordinates are inside an iframe, change the coordinates to be relative to the frame's location, communicate with the frame (probably viapostMessage
) to get it to callelementsAtPoint
, and then report back to the ObjC. (In addition to the other complications, this will go from being a synchronous call to async.)You can fool around with the iframe behaviour here:
http://nunzioweb.com/iframes-example.htm (Example 3)
The text was updated successfully, but these errors were encountered: