Focus tab or window

前端 未结 11 742
慢半拍i
慢半拍i 2020-12-06 16:19

for a little app, I\'m opening a few windows/tabs from my script. Whether the browser opens a window or a tab is of course not in my hand.

However, I hold the refere

11条回答
  •  不知归路
    2020-12-06 16:35

    Expanding on Alex's contribution above. The use case is having a CMS. When a site owner is logged into the CMS, and the front end is loaded in another tab. You give the site owner a link on the front end that reloads the CMS tab and focuses is.

    Place this javacript on front end pages (or include in a global JS file):

    
    

    I like to put the CMS link just after the H1 content. Again, this is only if they are logged into the CMS. In this case I am pointing to a Framed CMS, so it has to know what to load into the main frame (pun intended).

    Page Heading Edit this page

    This to make sure the tab is unique, in case I have several CMSs in my browser (support multiple clients):

    target="#cgi.server_name#wvAdmin"

    Finally, on the frame loader in the CMS, add this...

    
    

    ... to ensure that if the user opened the CMS on their own, we can still work with it.

提交回复
热议问题