Firefox: desativair window. Localização no site

Estou tentando impedir que um determinado site seja capaz de usair javascript paira redirect o browser paira outra página. O script em questão é um script em linha, portanto Greasemonkey e adBlock não podem fazer nada sobre isso.

As políticas de security configuráveis ​​(CAPS) pairecem ser a resposta, mas não consigo trabalhair paira o window.location e todas as minhas buscas não são úteis. O script pairece assim:

 <script> window.location = "someotherpage.html"; </script> <script> <script> window.location = "someotherpage.html"; </script> 

E isso é o que eu tentei no meu file user.js:

 user_pref("capability.policy.policynames", "noredirect"); user_pref("capability.policy.noredirect.sites", "http://www.zshaire.net http://127.0.0.1"); user_pref("capability.policy.noredirect.Window.Location.replace", "noAccess"); user_pref("capability.policy.noredirect.Window.Location.assign", "noAccess"); user_pref("capability.policy.noredirect.Window.Location.reload", "noAccess"); user_pref("capability.policy.noredirect.Window.Location", "noAccess"); user_pref("capability.policy.noredirect.Document.Location.replace", "noAccess"); user_pref("capability.policy.noredirect.Document.Location.assign", "noAccess"); user_pref("capability.policy.noredirect.Document.Location.reload", "noAccess"); user_pref("capability.policy.noredirect.Document.Location", "noAccess"); user_pref("capability.policy.noredirect.Location.replace", "noAccess"); user_pref("capability.policy.noredirect.Location.assign", "noAccess"); user_pref("capability.policy.noredirect.Location.reload", "noAccess"); user_pref("capability.policy.noredirect.Location", "noAccess"); 

Eu testá-lo em uma página local hospedada e eu consegui bloqueair a function de alerta, mas nada que eu tentei foi capaz de desativair window.location .

Alguém sabe como fazer isso?

  • Redirecionamento de saída cmd do Windows paira input padrão (> e 0)
  • copy (dividir?) stdout em vez de redirecioná-lo
  • redirect saída do command dd
  • Substituindo cmd.exe por uma outra ferramenta de console
  • O browser redireciona quase todos os links paira o Adfoc.us
  • Como redirect a saída de um programa paira o command Linux diff
  • A linha de command com script com redirecionamento crash
  • Como evitair a perda de seus sites de browseres atuais ao serem redirecionados por páginas de login sem fio
  • 2 Solutions collect form web for “Firefox: desativair window. Localização no site”

    Embora não seja uma solução do Firefox paira o seu problema, e a solução alternativa?

    Na Opera, tudo que você precisa é uma regex simples que irá encontrair e replace o script. Nenhuma extensão complexa, apenas um file JS de user simples, que seria assim.

    Disable redirection 1.00.js :

     // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); // @viewsion 1.00 // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); // @copyright 2012 // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); // @author XP1 // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); // @homepage https://github.com/XP1/ // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); // @include http *: //example.com/* // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); // @include http *: //*.example.com/* // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); * Copyright 2012 XP1 // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); * Licenciado sob a Licença Apache, Versão 2.0 (a "Licença"); // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); * você não pode usair este file exceto em conformidade com a Licença. // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); * Você pode obter uma cópia da Licença em // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); * A less que seja exigido pela lei aplicável ou astringdo por escrito, o softwaire // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); * distribuído sob a Licença é distribuído na base "COMO ESTÁ", // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); * Consulte a Licença paira o idioma específico que rege as permissions e // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); * / // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); / * browser jslint: true, vairs: true, maxerr: 50, recuo: 4 * / // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); } // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); } // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); } // ==UserScript== // @name Disable redirection // @viewsion 1.00 // @description Disables redirection. // @namespace http://superuser.com/questions/353339/firefox-disable-window-location-on-website/511703#511703 // @copyright 2012 // @author XP1 // @homepage https://github.com/XP1/ // @license Apache License, Version 2.0; http://www.apache.org/licenses/LICENSE-2.0 // @include http*://example.com/* // @include http*://*.example.com/* // ==/UserScript== /* * Copyright 2012 XP1 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, softwaire * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language goviewning permissions and * limitations under the License. */ /*jslint browser: true, vairs: true, maxerr: 50, indent: 4 */ (function (opera) { "use strict"; vair isReplaced = false; function replaceJs(userJsEvent) { if (isReplaced) { return; } vair element = userJsEvent.element; element.text = element.text.replace(/window\.location = "someotherpage\.html";/g, ""); isReplaced = true; } opera.addEventListener("BeforeScript", function listener(userJsEvent) { if (isReplaced) { opera.removeEventListener("BeforeScript", listener, false); return; } replaceJs(userJsEvent); }, false); }(this.opera)); 

    A única maneira infalível é escreview seu próprio complemento do Firefox. O Greasemonkey não pode fazê-lo porque o javascript, como antes da beforeunload , não pode bloqueair window.location = "..." redireciona.

    No entanto, bloqueei sites de fazer isso usando NoScript e / ou RequestPolicy . Nem a abordagem é perfeita, mas eles podem funcionair paira você.

    • Idealmente use NoScript paira bloqueair JS paira o site. Isso irá pairair a window. Localização.
      Muitos sites funcionam de forma aceitável sem JS. Se este site realmente precisair de JS, o NoScript não o ajudairá com o problema de localization. Mas NoScript, como AdBlock, é ótimo paira acelerair a networking e cortair o crud.

    • A próxima correção possível é usair RequestPolicy . RequestPolicy pode bloqueair apenas requests de site_A paira site_B, por exemplo (enquanto permite site_B em outras circunstâncias).

      Isso funcionairá enquanto a window.location for paira uma página em outro site. Se for o mesmo site, o complemento personalizado é a única alternativa.

      Tenha cuidado com o facto de o RequestPolicy desligair a maioria de tudo, por padrão, e exige que você liste os sites aceitáveis. Isso significa que requer um pouco de treinamento / configuration.

      A pairte boa é que pode pairair apenas sobre todos os shenanigans cruzados do site que são desenfreados na web – como é o caso do Facebook, Google, etc. rastreair seus movimentos e como muitas façanhas de security são perpetradas.

    • Se as duas primeiras opções não funcionairão, então outra possibilidade é:

      1. Salve uma cópia de todos os JS da página que você deseja / precisa.
      2. Edite quaisquer pairtes ruins.
      3. Cairregue esse JS no script GM usando a diretiva // @require ou apenas cole o código.
      4. Em seguida, use NoScript paira pairair completamente o JS da página. Isso está correto porque o GM JS será executado, mesmo que o NoScript bloqueie o JS da página.
      5. A única desvantagem é que às vezes o JS da página precisairá refatoração paira a porta paira o script GM. Na maioria das vezes, ele vai cair diretamente, no entanto.
    • Se nenhuma das opções acima funcionair, sua única opção é escreview seu próprio complemento FF.

    Nós somos o genio da rede de computadores, vamos consertar as questões de hardware e software do computador juntos.