在不触发弹出过滤器的情况下打开数组中的链接


Open links from an array without triggering the popup filter

我正在尝试开发一种工具,它可以从页面中获取链接,将其存储在数组中,并在新选项卡中单击即可打开。有没有一种方法可以在不触发浏览器弹出垃圾邮件过滤器的情况下实现这一点?

这是我的代码:

<?php 
    $base = "web.archive.org";
    $time = "/web/20160101000000*/";
    $domain = @$_POST["domain"];
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_URL, "$base$time$domain");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT_MS, 20000); //in miliseconds

    $output = curl_exec($ch);
    curl_close($ch);

    # REPLACES ALL URLs OF WAYBACK MACHINE
    $replacedHrefHtml = preg_replace('/(href=")/', "href='"https://web.archive.org", $output);

    # REPLACES ALL SRCs OF WAYBACK MACHINE
    $replacedsrc = preg_replace('/(src=")/', "src='"https://web.archive.org", $replacedHrefHtml);

    #get wbCalendar
    $html = str_get_html($replacedsrc);
    $elem = $html->find('div[id=wbCalendar]', 0);
    #extract the links and store them into an array
    $data = array();
    $open = '';
    foreach($elem->find('a') as $element) {
           $extracted = $element->href;
           $open .= "window.open('{$extracted}'); ";
           $data[] = $extracted;
    }
    echo "<a href='"#'" class='"cd-read-more'" onclick='"{$open}'" style='"float:left;'">Open multiple links</a>";

?>

你可以在这里测试:seotify.com/archive-eopener

提前谢谢。

据我所知,你无法确保弹出过滤器不会抓住你。我认为你唯一能做的就是在"点击"事件someElement.onclick = function(){ /*POPUP CODE*/ }中打开窗口(这样代码就会被触发以响应用户操作)