سؤال

I'm using a jquery-ui dialog although I could switch to fancybox or colorbox, etc if I had to. My chrome plugin content-script opens this dialog on page load. In jquery-ui, a div that the box was attached to is moved into the body of the current page. If the user clicks a link on the page I would like that box to stay open instead of re-opening once the new page loads, as if it is associated more with the browser than with the actual page you are on. This may be possible by framing the page and having the box be in another frame but I doubt that this will work on many sites. Any ideas?

هل كانت مفيدة؟

المحلول 2

I'm going to answer this myself. The only thing I have found that qualifies as able to persist a content-script created div / iframe is an experimental feature in chrome called panels. For now this feature must be enabled through the

chrome://flags page:

Enable Panels Mac, Windows, Linux, Chrome OS Enable Panel windows that open outside of the browser frame. Attempts to open a Panel will open a popup instead if not enabled. Panels are always enabled on the dev and canary channels.

"panel" can be specified as the window type as seen here: http://code.google.com/chrome/extensions/windows.html#type-Window If the panels experimental feature is not enabled in chrome, a new window popup will be used by default.

نصائح أخرى

The only way you will keep the UI dialog open, as far as I can see, is to either use an iFrame into which the new page gets loaded, or to load the new page into a specific content div by using (for example) jQuery load() (or ajax() or post() or get()) - while you keep the UI dialog div OUTSIDE of the iFrame or content div.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top