On Saturday, September 5, 2020 at 12:17:05 PM UTC-7, Jan wrote:
>
> it's marvelous. Your instruction was perfect. (...and I see that I was not 
> really awake this morning.)
> This is a great help to integrate external content into tiddlywiki, thanks 
> a lot!
>

Good to know it's working.

One more suggestion:

When I checked your latest test case 
at https://www.szen.io/Kunstgeschichte/#FlexframeTest, it gave a RMOD (Red 
Message of Death) to report an "Uncaught Security Error".  This is due to 
the fact that your test is attempting to modify a "cross-origin" IFrame 
(with contents from wikipedia).  As I noted in my instructions:

** IMPORTANT NOTE: the src="..." file must be from the *same domain* as 
> your TiddlyWiki file because, for security reasons, modern browsers do not 
> permit "cross-domain" access to the "document" object of another file.*


There's no way to make the code work for cross-origin references... but you 
*can* suppress the error message by adding a try/catch wrapper around the 
hook code, like this:
exports.startup = function() {
   $tw.hooks.addHook("th-page-refreshed",function() {
      setTimeout(function() {
         try {
            var iframes = document.querySelectorAll("iframe");
            for( var i = 0; i < iframes.length; i++) {
               iframes[i].height = iframes[i].contentWindow.document.body.
scrollHeight;
         } catch(e) { /* do nothing */;   }
      }, 1000);
   });
   $tw.hooks.addHook("th-navigating",function(event) {
      setTimeout(function() {
         try {
            var iframes = document.querySelectorAll("iframe");
            for( var i = 0; i < iframes.length; i++) {
               iframes[i].height = iframes[i].contentWindow.document.body.
scrollHeight;
         } catch(e) { /* do nothing */;   }
      }, 1000);
      return event;
   });
};

Let me know how it goes...

enjoy,
-e

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/86460c90-cb0c-4788-bdca-d4be78b96c70o%40googlegroups.com.

Reply via email to