I am having getting multiple window location selectors to work. The result im looking for is a test alert popup. I am not sure what I am doing wrong. I am using this in GreaseMonkey.
// ==UserScript==
// @name b
// @namespace d
// @description b
// @include *www.*
// @include http://*
// @include https://*
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
// ==/UserScript==
$(document).ready(function ()
{ if( (!window.location.href("https://www.youtube.com") > -1)
& (!window.location.href("https://www.google.com") > -1)
)
{
alert("I am an alert box!");
}
});
You have two issues in your code:
1) Error in conditional statement &
should be &&
2) also you need to use indexOf
to find index of desired uri in href:
if((!window.location.href.indexOf("https://www.youtube.com") > -1)
&& (!window.location.href.indexOf("https://www.google.com") > -1)
)