Preventing elements in popup.html from reloading

631 views
Skip to first unread message

Steve W

unread,
Apr 1, 2010, 7:55:17 PM4/1/10
to Chromium-extensions
Hi,

If my popup.html contains a frame that loads an external page, is
there a way to prevent the frame from reloading each time the popup is
invoked? I see that background.html is constantly active in the
background, so can the frame be loaded in background.html and embed
background.html in popup.html instead? Alternatively, can
document.importnode be used to move the node from background.html to
popup.html?

Thanks
Steve

Antony Sargent

unread,
Apr 2, 2010, 8:48:27 PM4/2/10
to Steve W, Chromium-extensions
Whoa, I had never heard of document.importNode. This actually appears to work, at least for a simple div inside the background page itself (I haven't tested with contents from an iframe).

In my popup.html:

<script>
var bg = chrome.extension.getBackgroundPage();
var node = document.importNode(bg.document.getElementById("foo"), true);
document.body.appendChild(node);
</script>




--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


Reply all
Reply to author
Forward
0 new messages