사용자가 이미 구문 분석 된 페이지에 있는지 여부를 감지하고 값이 아닌 경우 API에 전달해야하는 북마크릿을 작성하려고합니다. 이자바 스크립트 북마크 If-Else
if (window.location.indexOf("thequeue.org") >= 0) {
alert("Drag the Bookmarklet in your Brookmarks Bar!");
} else {
location.href = 'http://thequeue.org/r?id=' + encodeURIComponent(location.href) + '&title=' + document.title;
}
일반적으로 북마클릿에 대한 몇 가지 자습서,하지만 난이 변환 도구를 발견 : http://jasonmillerdesign.com/Free_Stuff/Instant_Bookmarklet_Converter, 나에게이 준 : 북마크가 완전히 작동을 멈 춥니 다 그러나
javascript:(function(){if(window.location.indexOf(%22queue.org%22)%20%3E%3D%200)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alert(%22your%20url%20contains%20the%20name%20franky%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20else%20%7B%0Alocation.href%3D'http%3A%2F%2Fthequeue.org%2Fr%3Fid%3D'%2BencodeURIComponent(location.href)%2B'%26title%3D'%2Bdocument.title%3B%0A%7D}());
. 이 작품이 작동하는지 확인할 수 있습니다 : javascript:location.href='http://thequeue.org/r?id='+encodeURIComponent(location.href)+'&title='+document.title;
내가 뭘 잘못하고 있니?
감사합니다. 더블을 작은 따옴표로 바꾸기 만하면됩니다. – mmackh