Accessing result of html embed in TiddlyWiki

169 views
Skip to first unread message

TonyM

unread,
Mar 7, 2019, 8:02:05 PM3/7/19
to TiddlyWiki
Folks,

Accessing result of html embed in TiddlyWiki
  • With the advent of HTML5 there is the embed tag https://www.w3schools.com/tags/tag_embed.asp
  • I can use this and reference a file in the local directory to my single File Tiddlywiki. CSS Text and JSON can be included and can be subsequently transcluded.
  • I can see the content of the file rendered in front of my eyes
  • However I have not yet being able to find a way to wikify the content, or query a json tiddler so referenced contents.
Eg
<embed src="Home.txt" style="Width: 100%;">

<embed src="testjson.json" style="Width: 100%;">


Can anyone give me some tips on how to make use of such data?

This is in an attempt to interrogate the contents of a file in the wikis current folder to see if that file is "Checked out"

SImilarly
I want to find a method to write to such a file,
 to checkout or check in. The assumption is the user must have read/write access but also check it out to themself before being permitted to save.

Regards
Tony

TonyM

unread,
Mar 7, 2019, 8:26:06 PM3/7/19
to TiddlyWiki
Post Script

This should be possible even if with a plugin since file save and backup tools can save backup files, and presumably check for the existence of existing backups.

I am not sure people have recognised how powerful it would be to allow serial edit via a checking process for single file wikis since they do not allow simultaneous edit directly.

Such files could also be set to be marked read only if not in their original location.

Regards
Tony

TonyM

unread,
Mar 8, 2019, 1:55:13 AM3/8/19
to TiddlyWiki
Also I note that the HTML Object tag also displays external content

<object width="100%" height="300" type="text/html" data="Home.txt" border="1" > </object>

Definition and Usage

The <object> tag defines an embedded object within an HTML document. Use this element to embed multimedia (like audio, video, Java applets, ActiveX, PDF, and Flash) in your web pages.

You can also use the <object> tag to embed another webpage into your HTML document.

You can use the <param> tag to pass parameters to plugins that have been embedded with the <object> tag.


Regards

Tony

CHUN LI

unread,
Mar 8, 2019, 2:04:59 AM3/8/19
to tiddl...@googlegroups.com
Hi Tony,

I am looking for the same thing! See someone did it this way. 

Sorry if I misunderstood what you want as I didn’t read the details in all your posts. But let me know if this works or not.

Kind regards,

Chun

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/82a912b3-e94e-4a3e-abc9-761e8554924c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TonyM

unread,
Mar 8, 2019, 7:21:55 AM3/8/19
to TiddlyWiki
Chun

Thanks for the lead bit I cant see the method as its too far off whay I am looking for.

But thanks
Tony

Jeremy Ruston

unread,
Mar 8, 2019, 7:30:59 AM3/8/19
to tiddl...@googlegroups.com
Hi Tony

Sadly browser security restrictions mess everything up. Pages hosting an iframe, img, object or embed that references a remote resource cannot access the resource itself in any way, they can only manipulate the container that is used to display them.

The exception that we take advantage of for the plugin library is that pages hosting iframes can exchange pre-arranged messages via the window.postMessage API. It’s that mechanism that allows a TW hosted on your desktop to directly access resources hosted on a remote resource.

The root cause here is the “same origin policy” restrictions. You can read more here:

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

TonyM

unread,
Mar 8, 2019, 6:43:47 PM3/8/19
to TiddlyWiki
Jeremy,

Thanks for the links I will read and research. The first thing that comes to mind is I am only interested in files at the same url and/or subfolder, I would have thought these have the same origin and thus considered safe.

Also in regards to using the data in an include is the idea of screen scraping obsolete?

Regards tony.

TonyM

unread,
Mar 9, 2019, 1:24:48 AM3/9/19
to TiddlyWiki
Jeremy,

Just to confirm, I am only looking at same origin. I want to bring content such as text, json etc.. From the same location as the wiki or a subfolder within and interogate it as if it were a tiddler.

With a host connection that permits save eg timimi on file and tw-reciever on php then just as backup solutions can create backup files, I want to write/post the content of a tiddler back to the host even if only to existing files, with write or append permissions.

It would also be nice if the iframe communication messages could be generalised such that superusers could install a plugin in two wikis of same or different origin. Then a subwiki could be interrogated or asked to save some values on behalf on the parent wiki.

Regards
Tony

PMario

unread,
Mar 9, 2019, 5:08:08 AM3/9/19
to TiddlyWiki
On Friday, March 8, 2019 at 2:26:06 AM UTC+1, TonyM wrote:
This should be possible even if with a plugin since file save and backup tools can save backup files, and presumably check for the existence of existing backups.

Hi Tony,
You can __not__ check the filesystem, if a file exists. All what you get is some info from the browser download history, which has noting to do with the real file.

-m

Mat

unread,
Mar 9, 2019, 6:11:18 AM3/9/19
to TiddlyWiki
Actually...

...it IS possible the browser as a file explorer and open local files in a local TW in an iframe: At least in Windows 10, Chrome and FF:
Open a local copy of, say, empty.html. Copy-paste the local file path to a directory into the browser url field. At least in Windows 10, Chrome and FF (attached image. The "file:///" prefix is automatically added as you paste the path). There, you can navigate between folders and also open files, still within the browser, e.g json files (seen as text) and html files (executing it so it shows as normal local webpage) and mp3 files play using the browser player.



Skärmklipp.PNG





And this can be iframed in TW. Here, in the local folder, I clicked a link to a local copy of "full.html". You can also open individual tiddlers, if they are saved as such, but for it to be a nice looking tiddler it must(?) be a static html tiddler.

Skärmklipp.PNG

:

...AND it is actually possible to open the hosting TW from within the iframe (i.e open the TW inside itself) and then make changes in the iframed "copy" and save (using same file name of course)... and then refresh the hosting TW to update and get the changes!


<:-)

Mat

unread,
Mar 9, 2019, 6:24:09 AM3/9/19
to TiddlyWiki
On Saturday, March 9, 2019 at 12:11:18 PM UTC+1, Mat wrote:
...AND it is actually possible to open the hosting TW from within the iframe (i.e open the TW inside itself) and then make changes in the iframed "copy" and save (using same file name of course)... and then refresh the hosting TW to update and get the changes!


So no misunderstanding: that saving is done INSIDE the iframe. Obviously, if you thereafter save the outer TW before the refresh, then the "iframed save" is overwritten. I'm guessing the nodejs version would avoid this restriction.

Note that media queries, and maybe other techniques, could (probably) be used to sense if the wiki is presented as the outer TW or an iframed one so that e.g the save wiki button is shown in the iframe without need to scroll the iframe. The tiddlers could probably also be styled so that you only see the desired fields.

BTW, if I recall, the current implementation of the editor actually has it in an iframe in native TW (but I'm not sure why). I'm thinking we should be able to take advantage of this and point the content of that TW to wherever we want.

<:-)


Jeremy Ruston

unread,
Mar 9, 2019, 7:17:07 AM3/9/19
to tiddl...@googlegroups.com
Hi Tony

> Thanks for the links I will read and research. The first thing that comes to mind is I am only interested in files at the same url and/or subfolder, I would have thought these have the same origin and thus considered safe.

If the files are in the same origin then you can simply retrieve them with xmlhttprequest; there’s no need for embeds etc.

(However, note that most browsers do not allow xmlhttprequest in pages loaded from a file URI).

> Also in regards to using the data in an include is the idea of screen scraping obsolete?

Not at all, but it’s easy to do from a server and almost impossible from a browser, and so all prior work takes the former approach.

Best wishes

Jeremy

>
> Regards tony.
>
> --
> You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
> To post to this group, send email to tiddl...@googlegroups.com.
> Visit this group at https://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f72c7363-bf58-4261-9b17-8328300aa2c9%40googlegroups.com.

Mat

unread,
Mar 9, 2019, 1:36:40 PM3/9/19
to TiddlyWiki
I don't know if it is of use but googling "javascript file browser" I get some interesting stuff like;
<:-)

TonyM

unread,
Mar 9, 2019, 6:39:40 PM3/9/19
to TiddlyWiki
Thanks all

There are a number of leads embeaded in all your responses and whilst responding to the original thread there are a number of technical diversions. I now have some answers found outside this thread which is not using the facility requested. Limitations can be the mother of invention. I will share my result later.

Let me try and state why I asked this original question;

I thought it was an avenue to implementing check-in and checkout facilities on single file wiki hosted for more than one user with the access to save the wiki. This to me is a major missing piece in tiddlywiki I have asked for many times and have not got a full working answer.

To keep it simple, using html embed I can see the content of files, with the same origin, inside my tiddler. When I transclude such a tiddler it transcludes the embed statement the displays the external file. I want to process the content, be it text, a data tiddler, a json.

If I can achieve this small step I am 80% of the way.

I want to put the content of the embedded file into a real tiddler, a variable or parse that file into tiddlers. This would allow content generated elsewhere to be used in my wiki.

I think I should stop there for now to make this clear.

I want to be able to process this content.

Regards
Tony

Reply all
Reply to author
Forward
0 new messages