Hello,
it is really sad that there is no rather easy (or none at all?) way to
render remote widgets as persistent popups. I do not see issues there
and its already possible, but not in a persistent way :(.
the last idea I had, but could not fully implement was:
1. Adopting from Background - Cloning within the Popup - and pushing
back to the Background (.e.g. adopting from the Popup).
2. Each time content within the iframe changes (e.g. iframe location
or src="" changes or a user would hit /enter/ within or onclick onto
the iframe) it would push it back to the Background.
// something along this:
function pull() {
var bg = chrome.extension.getBackgroundPage();
var node =
document.adoptNode(bg.document.getElementById("container"), true);
var nodeClone = node.cloneNode(true); // maybe I could just use
cloneNode once instead of multiple adoptNode
document.body.appendChild(node);
var node =
bg.document.adoptNode(document.getElementById("container"), true);
bg.document.body.appendChild(node);
document.body.appendChild(nodeClone);
}
function push() {
var bg = chrome.extension.getBackgroundPage();
var node =
bg.document.adoptNode(document.getElementById("container"), true);
var nodeClone = node.cloneNode(true);
bg.document.body.appendChild(node);
var node =
document.adoptNode(bg.document.getElementById("container"), true);
document.body.appendChild(node);
bg.document.body.appendChild(nodeClone);
}
The issues I have/had are:
1. I am not sure if cloneNode enables persistent transport of iframes
between dom trees. There are probably other hacks around this:
http://codingforums.com/showpost.php?p=499157&postcount=2 (I had
issues with SameOrigin on this one)
http://psoug.org/snippet/Javascript-Copy-IFRAME-contents_124.htm
http://www.quirksmode.org/bugreports/archives/2004/11/Cloning_nodes_from_an_iframe.html
http://msdn.microsoft.com/en-us/library/ms536365(VS.85).aspx (IE
specific but maybe still useful)
2. I guess if you adopt from the popup there will be a tiny second
where the UI moves around as the actual DOM tree is modified. This is
rather unacceptable.
3. I found no way to detect interaction with the iframe.
setInterval(function () {
alert($('#iframe').attr('src')); // won't change if the user
navigates around :/
}, 3 * 1000);
... didn't change when the user interacted with the iFrame + if it
worked, it would work with GET only, not on changes done via POST/PUT/
DELETE on the same http address.
If any of you find any way in future or if this issue is being
resolved (direct support for persistent popups or onunload/
onbeforeunload),
...: please let me know!
Until then,
Jonas H.
On Oct 11, 8:47 am, PhistucK <
phist...@gmail.com> wrote:
> Inline comments.
>
> ☆*PhistucK*
> > > > <
chromium-extensions%2Bunsubscr...@chromium.org<
chromium-extensions%252Bunsubscr...@chromium.org>
> > <
chromium-extensions%252Bunsubscr...@chromium.org<
chromium-extensions%25252Bunsubscr...@chromium.org>
> > > > <
chromium-extensions%2Bunsubscr...@chromium.org<
chromium-extensions%252Bunsubscr...@chromium.org>
> > <
chromium-extensions%252Bunsubscr...@chromium.org<
chromium-extensions%25252Bunsubscr...@chromium.org>
> > To post to this group, send email to
chromium-extensi...@chromium.org.