我是中国互联网用户。 Google/Yahoo搜索引擎在我的国家非常不稳定。
当我点击雅虎搜索结果的链接,我经常会收到这样的错误页面:如何在单击链接时将“href”更改为“dirtyhref”?
ERROR
The requested URL could not be retrieved
While trying to retrieve the URL: http://search.yahoo.com/r/_ylt=A0oGdUY7FbNQFQsA5rZXNyoA;_ylu=X3oDMTE0ODJ2YTduBHNlYwNzcgRwb3MDMQRjb2xvA3NrMQR2dGlkA1ZJUDA1MV83Ng--/SIG=11ac0sa5q/EXP=1353942459/**http%3a//www.google.com/
The following error was encountered:
Access Denied.
Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.
Your cache administrator is [email protected]
by DXT-GZ-APP02
我注意到,雅虎将改变href
到dirtyhref
值自动当我点击一个链接。我试图$('a[id|=link]').unbind('click mousedown')
,但它不起作用。
如何阻止雅虎做到这一点?
目前,我用这个Firefox的Greasemonkey代码:
// ==UserScript==
// @name Clean URL
// @namespace http://hjkl.me
// @include https://www.google.com/search*
// @include http://search.yahoo.com/search*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @version 1
// ==/UserScript==
// GOOGLE
$('h3.r>a').removeAttr('onmousedown');
// YAHOO
$('a[id|=link]').on('click', function(){
var url = $(this).attr('dirtyhref').split('**')[1];
url = decodeURIComponent(url);
$(this).attr('href', url); //<-- yahoo will change it back!
window.open(url, '_blank');
return false;
});
的问题是:我不能使用鼠标中键单击功能。 (无声打开tabpage)
改回手动? –
当我将它改回去时,雅虎将会再次改变它。 – kev
您是否在单独的窗口(无导航)或搜索窗口中打开链接(在导航回时更改)? –