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


(Vishwas Gagrani) #1

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>

(Loves Hype) #2

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.


(Vishwas Gagrani) #3

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.


(Loves Hype) #4

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


(Jonathan Deutsch) #5

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?


(Vishwas Gagrani) #6

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.


(Loves Hype) #7

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)


(Loves Hype) #8