Open multiple links in Chrome at once as new tabs

前端 未结 7 1579
小蘑菇
小蘑菇 2020-11-29 09:32

I\'m trying to open multiple links at once in Google Chrome in new tabs but it fails.

Problems:

  1. Blocked by popup
  2. Open in new windows instead o
7条回答
  •  时光说笑
    2020-11-29 09:43

    Since modern browsers (and even old ones with blockers), will absolutely not allow this (one user action, one new tab). My solution was:

        openInfoLinks = () => {
            const urlsArray = [
                `https://...`,
                `https://...`,
                `https://...`,
            ]
            window.open(
                urlsArray[this.linkCounter],
                `_blank_${someIdentifier}_${this.linkCounter}`
            );
            this.linkCounter++;
            setTimeout(() => {
                this.linkCounter = 0;
            }, 500);
        }
    

    The user can open the links in quick succession with ctrl+click-ing the button N times.

提交回复
热议问题