How do I make a script not work in the Opera browser?

Asked

Viewed 43 times

0

I want my script to work in all browsers, except for in Opera. What do I have to add to my code to block its operation in Opera? The script I use is:

<script>
        function openWindow() {
           window.open("banner","_blank","width=400px,height=400px,top=100,left=250");
        }
</script>
  • I didn’t look to see if your question has been answered before, but I found this one that I think can help you

1 answer

0

Opa, as follows: you create a variable and assign the parameter "Navigator.useragent", this variable will now hold the browser information. See the position of this information inside the String that will be in this initial variable.

Now use the index in the variable that contains your browser information by assigning it to another variable ai is only you apply a simple if to call the Function that you want or not.

In my case I used an Alert instead of the function and the Firefox browser to test

Good luck my dear....

    var browser = navigator.userAgent;
    var qualbrowser = browser.indexOf('Firefox');

    if(qualbrowser > 10){
    alert(qualbrowser);

    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.