Get list of opened popup windows

后端 未结 2 2039
无人共我
无人共我 2020-12-06 14:13

I would like to know if I can get a list of popups opened by window.open javascript function call.

I want to run some code after all these pages are closed. I don\'

2条回答
  •  生来不讨喜
    2020-12-06 14:44

    you can use localstorage to do this. I am also using a localstorage plugin so the set and get are short hand.

    function Op(r,rr,rrr){
        if(!rrr){rrr={};};if(!rrr.n){rrr.n='PopUps'}
        ii={o:jQuery.localStorage.get(rrr.n)}
        if(!ii.o){
            switch(rrr.n){
                case'unmOptions':
                    ii.o={audio0:1,audio1:1}
                break;
                default:
                    ii.o={p:{}}
                break;
            }
        }
        if(r&&rr&&!rrr.x){
            ii.o[r]=rr;
        }
        switch(rrr.x){
            case 0:
                delete(ii.o[r])
            break;
            case 1:
                delete(ii.o[r][rr])
            break;
        }
        jQuery.localStorage.set(rrr.n,ii.o)
        return ii.o
    }
    

    How to get object of windows

    Op()
    Op().p['window1']
    

    to set values

    Op('key','value')
    

    to delete values

    Op('key','',{x:0})
    

提交回复
热议问题