Creating new tab / switching between Tabs in Firefox?

前端 未结 8 734
感动是毒
感动是毒 2021-01-16 08:14

I am looking for a way to improve the workflow in a PHP based CMS. There is a lot of switching between the editor mode and the preview mode of the page. The editor mode is h

相关标签:
8条回答
  • 2021-01-16 08:36

    There is no way to force a window to open as a tab. It's all dependent on the user's preference settings.

    0 讨论(0)
  • 2021-01-16 08:37

    I second the answers that say you should do this in HTML using Javascript. Then it can work in all browsers that support JS.

    I would put two divs on the page and show/hide each div depending on which tab is selected. If you are clever about this you could trap the click on the tab and determine if the user left-clicked or middle-clicked. If they left click you load that tab on the page. If they middle-click you let the browser open a new tab/window (according to the user's prefs, don't try to force it), and leave the current window unchanged (that is, don't switch to the new tab). The action for clicking on the tab would be to use AJAX to load the contents of the remote document and put it into the tab. Use Javascript to modify the URL before submitting the AJAX request so that the server knows to send a web page fragment instead of the whole page.

    The advantage of this dual-natured solution is that the tabbed approach will work the way you want it to work for the majority of cases, but for users with, say, two screens, or who prefer switching between browser tabs, they will still have the flexibility to work in multi-window mode. This can all be done without any browser extensions and it should work equally well in IE as well as Firefox, Opera, etc. Avoid locking yourself into one browser, even one as excellent as Firefox. One day a customer will need to use Opera or Safari and you'll be stuck.

    0 讨论(0)
  • 2021-01-16 08:38

    You can't force a tab, but if you use a target with a specific name, like target="my_cms_window", many browsers will open this as a new tab. Additionally, they will remember the name and if you use the target repeatedly, put the contents in the same tab. I have found that this works pretty well in the real world.

    0 讨论(0)
  • 2021-01-16 08:44

    Nope, there's no way to force the opening of a new tab, simply because this would be unsupported by un-tabbed browsing

    You can only set it to open a new window, not a new tab.

    0 讨论(0)
  • 2021-01-16 08:47

    Greasemonkey springs to mind - a quick google gives open in tabs on left click. I think you could modify that so it only runs on one particular page, and you'd be up up and away.

    0 讨论(0)
  • 2021-01-16 08:54

    What about using iframes and JavaScript?

    I know you said you want to avoid 'confusion using iframes', but in my opinion if you really need to load different pages at the same time this is the best option.

    In theory, you could create your own tab system using javascript or even better, using jQuery, because its UI module offers pretty cool tab control.

    For every tab you could load separate "headerless-footerless" version of your specific admin page inside <iframe> element. If user wanted to modify something different, he will simply click on the tab and bring different iframe.

    All this could also be done using AJAX, but iframe solution is quite easy as you just need to load ready page and all postbacks are already handled by original page and separated from master-admin-page.

    You might also need to play a little bit to set correct height of your iframe to fit all the content without scrollbars, but this again, is just bit of javascript.

    0 讨论(0)
提交回复
热议问题