Safari 5에서 북마크 또는 북마크 바의 링크로 javascript 책갈피 렛을 사용하는 방법의 길이 제한이나 다른 변경 사항이 있습니까?Safari 5가 자바 스크립트 북마크 사용시 변경됩니까?
아래의 북마크 렛은 Safari 4에서 작동하지만 Safari 5에서는 "Safari는이 동작에 Javascript를 사용할 수 없습니다."라는 오류 메시지가 나타납니다. 두 번째 스크립트가 5에서 작동하고 새 창이 열리기 때문에 새 창을 여는 것과 아무 상관이없는 것처럼 보입니다.
브라우저 작업에 javascript를 사용하는 다른 방법으로는 북마클릿 또는 Safari 확장 기능이 있습니까?
업데이트 10/07/11 : 사파리 5하지만 실패
javascript:s=document.getElementsByTagName('STYLE'); ex=document.getElementsByTagName('LINK'); d=window.open().document; /*set base href*/d.open();d.close(); b=d.body; function trim(s){return s.replace(/^\s*\n/, '').replace(/\s*$/, ''); }; function iff(a,b,c){return b?a+b+c:'';}function add(h){b.appendChild(h);} function makeTag(t){return d.createElement(t);} function makeText(tag,text){t=makeTag(tag);t.appendChild(d.createTextNode(text)); return t;} add(makeText('style', 'iframe{width:100%25;height:18em;border:1px solid;')); add(makeText('h3', d.title='Style sheets in ' + location.href)); for(i=0; i%3Cs.length; ++i) { add(makeText('h4','Inline style sheet' + iff(' title="',s[i].title,'"'))); add(makeText('pre', trim(s[i].innerHTML))); } for (i=0; i%3Cex.length; ++i) { rs=ex[i].rel.split(' '); for(j=0;j%3Crs.length;++j) if (rs[j].toLowerCase()=='stylesheet') { add(makeText('h4','link rel="' + ex[i].rel + '" href="' + ex[i].href + '"' + iff(' title="',ex[i].title,'"'))); iframe=makeTag('iframe'); iframe.src=ex[i].href; add(iframe); break; } } void 0
북마크 :
북마크 이제 100% to 100%25
을 변경, 하나의 변화 (4하지만) 사파리 5에서 작동 4 일 : 새 창에서 작동
javascript:s=document.getElementsByTagName('STYLE'); ex=document.getElementsByTagName('LINK'); d=window.open().document; /*set base href*/d.open();d.close(); b=d.body; function trim(s){return s.replace(/^\s*\n/, '').replace(/\s*$/, ''); }; function iff(a,b,c){return b?a+b+c:'';}function add(h){b.appendChild(h);} function makeTag(t){return d.createElement(t);} function makeText(tag,text){t=makeTag(tag);t.appendChild(d.createTextNode(text)); return t;} add(makeText('style', 'iframe{width:100%;height:18em;border:1px solid;')); add(makeText('h3', d.title='Style sheets in ' + location.href)); for(i=0; i%3Cs.length; ++i) { add(makeText('h4','Inline style sheet' + iff(' title="',s[i].title,'"'))); add(makeText('pre', trim(s[i].innerHTML))); } for (i=0; i%3Cex.length; ++i) { rs=ex[i].rel.split(' '); for(j=0;j%3Crs.length;++j) if (rs[j].toLowerCase()=='stylesheet') { add(makeText('h4','link rel="' + ex[i].rel + '" href="' + ex[i].href + '"' + iff(' title="',ex[i].title,'"'))); iframe=makeTag('iframe'); iframe.src=ex[i].href; add(iframe); break; } } void 0
북마크는 :
javascript:var MTl=document.getElementsByTagName('script');for(var MTi=0,MTr,MTa=[];MTl[MTi];MTi++){if(MTr=MTl[MTi].getAttribute('src')){MTa[MTa.length]=MTl[MTi];}}if(!MTa.length){alert('This page does not use any external scripts');}else if(MTa.length==1){void(window.open(MTa[0].getAttribute('src')));}else{var MTw=window.open('');MTw.document.open();MTw.document.write('<html><head><title>External scripts for '+document.title+'<\/title><\/head><body><h1>External scripts for '+document.title+'<\/h1><p>');for(MTi=0;MTa[MTi];MTi++){MTw.document.write('<a href=\''+MTa[MTi].getAttribute('src')+'\'>'+(MTa[MTi].id?MTa[MTi].id:MTa[MTi].getAttribute('src').replace(/\/$/,'').replace(/^.*\//,''))+'<\/a><br>');}MTw.document.write('<\/p><\/body><\/html>');MTw.document.close();}
이것은 Safari Extension으로 더 잘 구현 될 수 있습니다. 그렇습니다. 스택 오버플로가 아마도 더 나은 장소가 될 것입니다. – dan8394
Safari 5는 북마크릿이 창을 열려고 할 때 마음에 들지 않는다고 생각합니다. – canisbos
위의 추가 북마크 렛이 있는데 사파리 5에서 새 창을 엽니 다. – markratledge