Is it possible to search text within user-defined iframes?
I have been playing with iframes to include external HTML generated with a sed script (successfully), only to discover that neither standard search nor the search operator finds anything within them … I guess it is not possible because the generated html is not stored in the tiddlers’ text field?
Not being a frontend developer and never having been one I had done some research before posting my question. I had missed @jeremyruston’s 2014 (!) replies to https://groups.google.com/g/tiddlywiki/c/K9O5eBkIuW0/m/9CGLgmecWXsJ though.
Jeremy talks about remote transclusion in his post. My wikis are all single html files, which use external files though. I have not tried the node.js version yet or other solutions that require a server. Also, apart from iframes, I have not found anything about local transclusion to transclude (in my case) external html fragments, which would simplify my workflow, and that would work both on MacBook and iPad. Editing the html by hand is tedious and laborious, even with custom snippets, and not very flexible (e.g. sorting after editing). As mentioned, I create simple text files (with vim, my favourite editor) that I then convert to html using a sed script. For iframes, that is all that is needed. Without iframes I then also have to delete, often partially, the content of the tiddlers and copy/paste the new content.
There may be better solutions than generating external html fragments, but so far, this approach has worked well for me.
That’s right. If the iframes show external content, the TW core does not know anything about it.
The only way that should work is the browser default search mechanism. CTRL-F, which should show you the native browser search, with an “highlight” option.
I know, but the browser only finds text in tiddlers that are open. These first have to be found. I have abandoned the iframes approach and instead now copy/paste the generated html, then use my custom search function and its Open button (Search formatted text) to open the tiddlers found and finally the browser’s Ctrl-F find. It would be useful if on Open Tiddlywiki could highlight the search text in the search result tiddlers.
@Jan if the content inside an IFrame is a single file wiki remember they can include a search parameter in the url so if you form the url correctly in the IFrame you can ineffect pass a search through to the iframed wiki.
This is infact true for any site you want to place in an IFrame such as a google search, or even the current page.
In truth any independent page you may open in an IFrame could just as easily open in a new tab with or without a search string on the url, this is the more common approach, and if you may open the tab multiple times provide a target window name in a link and each “search” will open the same tab
@TW_Tones: Interesting, thanks.
I’ll have a closer look at this just out of curiosity, although for now I have given up on using iframes.
Another reason for not using iframes is that they don’t work in Quine. Quine on iPad either does not find the files (stored in iCloud) or is unable to show the contents, the iframes are always blank. Quine on iPhone does show the content but garbles Russian text (this may be just a matter of setting the languages used in the fragments; without iframes this not a problem).
Adding <meta charset="UTF-8">
in the fragment solves the problem on iOS.