Reputation: 11
I have a problem when I use the network of my professional offices: when I do a Google search in private browsing, it systematically asks for a long and anoying captcha.
I found a solution that works: launch 3 occurrences of my search (in 3 tabs). The 3rd occurrence is displayed normally, without captcha request.
So, I would like to develop a PHP page that will open 2 new tabs with my search, then will close these 2 tabs after a timeout and at the end of this timeout will redirect my 1st tab to the Google search page.
Here is the code of my page. The problem is that it works perfectly if my redirection URL is not the search page. The script below works perfectly if I put "http://www.google.com" as my redirection address. However, if I put "http://www.google.com/search?q=mysearch" the two tabs do not close.
Here is my code:
<html>
<head>
<title>Redirect...</title>
<script language="javascript" type="text/javascript">
var url = "https://www.google.com/?q=".<?php echo $_GET['q']; ?>";
var google = window.open(url);
setTimeout(function(){google.close()}, 1000);
var googleb = window.open(url);
setTimeout(function(){googleb.close()}, 1500);
</script>
</head>
<body style="background-color:#202124">
<script>
setTimeout(function(){
window.location.href = 'https://www.google.com/search?q=<?php echo $_GET['q']; ?>';
}, 2000);
</script>
</html>
Do you see anything that prevents tabs from closing when I use a URL with this structure: "https://www.google.com/search?q=mysearch"?
I tried to replace the URL of the type "https://www.google.com/search?q=mysearch"? by a simpler URL like "https://www.google.com" and it works
Many thanks for your help!
Upvotes: 1
Views: 86