Are the FireFox special saving methods based on the Webkit?

27 views
Skip to first unread message

Yakov

unread,
Mar 22, 2011, 8:28:55 AM3/22/11
to TiddlyWikiDev
Hi.

While looking for saving methods for TW on handheld devices I've run
into a new Webkit-based mobile browser called Zetakey. So, an idea
blinked in my mind: as I understand TW uses special FireFox JavaScript
interface for saving changes in TW (without TiddlySaver, right?). So,
if this interface is a part of Webkit, this could be used in Zetakey
too (though, a bit of coding should be needed since TW checks if the
browser is *FireFox*).

Also, a friend of mine claimed that some browsers can use the "save
as" function to save TW since they keep the current DOM for saving
documents. Although even in this case saving throught "save as" can
work not with the current TW (for instance, some things can be stored
not in the DOM elements, I guess), after some tweaking it may work.

So, what do you think (first, it's interesting to hear what do you
know about technical details since I can have messed the things up)?

Yakov

unread,
Mar 22, 2011, 8:30:58 AM3/22/11
to TiddlyWikiDev
> since they keep the current DOM

I mean, use the current DOM, not the initial code, when saving.

Jeremy Ruston

unread,
Mar 22, 2011, 9:00:17 AM3/22/11
to tiddly...@googlegroups.com, Yakov
> While looking for saving methods for TW on handheld devices I've run
> into a new Webkit-based mobile browser called Zetakey. So, an idea
> blinked in my mind: as I understand TW uses special FireFox JavaScript
> interface for saving changes in TW (without TiddlySaver, right?). So,
> if this interface is a part of Webkit, this could be used in Zetakey
> too (though, a bit of coding should be needed since TW checks if the
> browser is *FireFox*).

TiddlyWiki uses XPCOM on Firefox to access various libraries that were
originally intended for use by Firefox extensions. It turns out that
Firefox allows access to these APIs for local files if the user grants
access:

https://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO

These APIs are not available in WebKit, and so I wouldn't expect them
to be available on Zetakey.

> Also, a friend of mine claimed that some browsers can use the "save
> as" function to save TW since they keep the current DOM for saving
> documents. Although even in this case saving throught "save as" can
> work not with the current TW (for instance, some things can be stored
> not in the DOM elements, I guess), after some tweaking it may work.

Firefox is the only browser I know that uses a snapshot of the current
DOM for file/save. You are right that with some tweaking TiddlyWiki
could be adjusted to allow allow saving in that way.

> So, what do you think (first, it's interesting to hear what do you
> know about technical details since I can have messed the things up)?

The best approach at the moment to getting TiddlyWiki saving locally
on a mobile device seems to be to create skinny wrappers around the
platform's native webview control. There are Android, iPhone and iPad
apps that exploit this technique to let you run and save any
TiddlyWiki document:

https://market.android.com/details?id=de.mgsimon.android.andtidwiki
http://itunes.apple.com/gb/app/twmobile/id381945222?mt=8
http://itunes.apple.com/gb/app/twedit/id409607956?mt=8

Cheers

Jeremy

--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com

Eric Shulman

unread,
Mar 22, 2011, 9:21:15 AM3/22/11
to TiddlyWikiDev
> While looking for saving methods for TW on handheld devices I've run
> into a new Webkit-based mobile browser called Zetakey. So, an idea
> blinked in my mind: as I understand TW uses special FireFox JavaScript
> interface for saving changes in TW (without TiddlySaver, right?). So,
> if this interface is a part of Webkit, this could be used in Zetakey
> too (though, a bit of coding should be needed since TW checks if the
> browser is *FireFox*).

FireFox is NOT Webkit-based. The file I/O functions in FireFox are
native to FireFox only. Webkit-based browsers use TiddlySaver.jar (a
*Java* applet) that provides the file I/O functions, which are then
invoked using javascript-to-java calling conventions.

> Also, a friend of mine claimed that some browsers can use the "save
> as" function to save TW since they keep the current DOM for saving
> documents.

Originally (back in 2004/2005), the tiddler data was held in DOM
element DIVs during the document session, and then written to the file
as text, using HTML syntax to define the tiddler DIVs. However, this
was found to be very limiting, due to browser differences in DOM
representation and performance issues related to DOM lookups/
manipulations.

To avoid this, the TiddlyWiki run-time data are read in from the
stored HTML and held in a javascript data object (the "store") during
the session, and then transcribed back into HTML syntax when the file
is saved. Obviously, this conversion between run-time data and HTML
syntax is not something that would be performed by invoking the
browser's built-in "file save..." command.

In addition, even for statically-defined HTML pages, the browser's in-
memory DOM image may differ in a number of ways as a result of
implicit character-set conversions, discarding of comments, collapsing
of whitespace, etc. While the "file save" result for typical web
pages is generally satisfactory, it doesn't actually save an *exact*
image of the original source file that was loaded into the browser.

Thus, for several important reasons, the browser's "file save..."
command simply *cannot* be used to save a TiddlyWiki document,
regardless of what your friend says *might* be possible.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Yakov

unread,
Mar 22, 2011, 2:06:07 PM3/22/11
to TiddlyWikiDev
Thanks Jeremy, thanks Eric

> to create skinny wrappers around the platform's native webview control

I wonder what the "wrapper" means. I mean, if I decide to write this
by myself, I have no idea where to look and what does this do (with
which libraries interacts etc); neither any idea of what native
webview control is and wether this thing is present in legacy mobile
platforms like Windows Mobile 5 in my case.

> FireFox is NOT Webkit-based

Oops. Now I know this :) probably I misread something in Wikipedia.

> then transcribed back into HTML syntax when the file is saved

As I understand this can be handled by adding a "semi-save" function
which would write the state from the store object into DOM, but as
long

> Firefox is the only browser [I know] that uses a snapshot of the current DOM for file/save

is true this is of no use. And

> character-set conversions, discarding of comments, collapsing of whitespace, etc

makes also some problems, especially character-set conversions.

One more question: what do you know guys about the Local Storage? I
mean, should it be hidden by browser from manual access? Developers
say that Zetakey implements Local Storage so I wonder if the work on
handheld can be done in the following manner: I work with TW, and the
alternations are kept in Local Storage. Than I copy my Local Storage
content from handheld to computer, apply some saving engine there, et
voila - here I have a TiddlyWiki, like as if I saved changes on the
mobile device.

Jeremy Ruston

unread,
Mar 23, 2011, 5:44:37 AM3/23/11
to tiddly...@googlegroups.com, Yakov
> Thanks Jeremy, thanks Eric
>
>> to create skinny wrappers around the platform's native webview control
>
> I wonder what the "wrapper" means. I mean, if I decide to write this
> by myself, I have no idea where to look and what does this do (with
> which libraries interacts etc); neither any idea of what native
> webview control is and wether this thing is present in legacy mobile
> platforms like Windows Mobile 5 in my case.

A webview control is a component available on some mobile platforms
that lets programmers incorporate the functionality of a web browser
into their applications. The iPhone/iPad and Android both provide an
instance of WebKit for this purpose. I believe that Windows Mobile 5
has a Pocket Internet Explorer ActiveX control along the same lines.

The wrapper application is a native application (.net in the case of
windows mobile) that uses the webview control to host a TiddlyWiki
file. It needs some form of communication into the webview control in
order to take over the "save" functionality; as far as I know all the
controls allow this by letting hosts intercept specially constructed
links navigated within the browser.

>> FireFox is NOT Webkit-based
>
> Oops. Now I know this :) probably I misread something in Wikipedia.
>
>> then transcribed back into HTML syntax when the file is saved
>
> As I understand this can be handled by adding a "semi-save" function
> which would write the state from the store object into DOM, but as
> long
>
>> Firefox is the only browser [I know] that uses a snapshot of the current DOM for file/save
>
> is true this is of no use. And
>
>> character-set conversions, discarding of comments, collapsing of whitespace, etc
>
> makes also some problems, especially character-set conversions.
>
> One more question: what do you know guys about the Local Storage? I
> mean, should it be hidden by browser from manual access? Developers
> say that Zetakey implements Local Storage so I wonder if the work on
> handheld can be done in the following manner: I work with TW, and the
> alternations are kept in Local Storage. Than I copy my Local Storage
> content from handheld to computer, apply some saving engine there, et
> voila - here I have a TiddlyWiki, like as if I saved changes on the
> mobile device.

It's not possible to transfer local storage content between
browsers/computers. So, it would let you persist changes made to a
TiddlyWiki document, but those changes would be tied to that browser.
It's more like a cache than a real storage mechanism.

Cheers

Jeremy

>
> --
> You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
> To post to this group, send email to tiddly...@googlegroups.com.
> To unsubscribe from this group, send email to tiddlywikide...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.

Yakov

unread,
Mar 23, 2011, 5:17:42 PM3/23/11
to TiddlyWikiDev
> A webview control is a component available on some mobile platforms
> that lets programmers incorporate the functionality of a web browser
> into their applications. The iPhone/iPad and Android both provide an
> instance of WebKit for this purpose. I believe that Windows Mobile 5
> has a Pocket Internet Explorer ActiveX control along the same lines.

I see. Actually, I even used a couple of applications which probably
use this thing (since they rendered html pages just like IE).
Unfortunatelly, IE doesn't allow TW to run as it should do (if it
opens TW, it shows just an empty page) -- only some other browsers do
(Opera Mobile, ..). So, this is rather hopeless.

After checking all the possibilities I can conclude that the only one
which allows to ~use and change~ TW on WM5 is usage of external files
(.txt's more likely) with some kind of plugin which would read them.
Anyway this wouldn't be handy. Though, there's one last chance -- to
discuss this with the developer of Mysaifu (GNU) JVM, but since there
also should be some interface in browser for this thing it's unlikely
that this would work.

Probably after checking this one I'll report the whole story.

Thanks for the discussion.
Reply all
Reply to author
Forward
0 new messages