Adding device detection code on an ad project is blocked by browser probably detecting it as malware

Adding device detection code on an ad project is blocked by browser probably detecting it as malware. I am not able to test this part. Do I need a whilte listed ad test server?

Here is the code.

 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
<script>
function getMobileOperatingSystem() {
  var userAgent = navigator.userAgent || navigator.vendor || window.opera;

      // Windows Phone must come first because its UA also contains "Android"
    if (/windows phone/i.test(userAgent)) {
        return "Windows Phone";
    }

    if (/android/i.test(userAgent)) {
        return "Android";
    }

    // iOS detection from: http://stackoverflow.com/a/9039885/177710
    if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
        return "iOS";
    }

    return "unknown";
}</script>

<script>
function DetectAndServe(){

if (getMobileOperatingSystem() == "Android") {
    window.location.href = "https://play.google.com/store/apps/details?id=com.bigfishgames.jackpotcityslotsf2pgoogle&hl=en_IN"; 
    }
if (getMobileOperatingSystem() == "iOS") {
    window.location.href = "https://itunes.apple.com/us/app/jackpot-magic-slots-casino/id1090242126?mt=8";
    }
if (getMobileOperatingSystem() == "Windows Phone") {
    window.location.href = "https://itunes.apple.com/us/app/jackpot-magic-slots-casino/id1090242126?mt=8";
    }
if (getMobileOperatingSystem() == "unknown") {
  window.location.href = "https://itunes.apple.com/us/app/jackpot-magic-slots-casino/id1090242126?mt=8";}
 

}


</script>
</head>
<body onload="">

    <button type="button" onclick="DetectAndServe()">Install the game!</button>

</body>
</html>

Works for me (Mac OS, Chrome)… and I got adblock plus installed. Maybe on your system the casino and jackpot keywords trigger some sort of block. Very common sources of spam.

1 Like

Hmm… Are you in US? Testers in US are seeing it blocked by their browser. I am wondering how to make it work for them to test this there.

I am not in the US. I am in Europe/Germany. I tested on a local file and put it on my server. Maybe the source server is the cause (and somehow blacklisted)… good luck

1 Like

What browser/device is detecting this as malware? This is not using any local blockers or proxies/firewalls, correct? Does it only happen when posted to a server? And simply removing those lines gets it working correctly?

I am not sure if they have got any additional proxies and firewall. All of their browsers were blocking it, so I think they got plugin installed on all of them.

However, when I tried to upload on gmail, it got blocked. So, I renamed the js files to js.txt and then it was fine.

Google Mail doesn’t allow any JS files as attachments also they don’t allow them
In ZIP files attached to emails. This is a fact discussed recently on this forum. Has nothing todo with Hype as it’s a general rule they impose on their users (to protect them from maleware)

1 Like
1 Like