Rclick menuext 在 Internet Explorer 中失败
我正在尝试使用我们编写的 JavaScript 获取任何网站的 url 和标题。我在 .HTM 中编写了 javascript,并从 menuExt 中的注册表中获取它。就像 file://C:\Users\lala\script.htm
这是我使用我的附加组件时的脚本
<script type="text/javascript" defer>
javascript:{var jolExt={url:"http://example.com/script_container.php?id=¬e=",submit:function(a){var b=jolExt.base64.encode(jolExt.strip(document.getElementsByTagName("title")[0].innerHTML));var d=jolExt.base64.encode(jolExt.strip(location.href));
window.open(jolExt.url+d+"¬e="+b,"","width=380,height=335")},submitToOtherJol:function(){jolExt.submit(true)},submitToJol:function(){jolExt.submit(false)},strip:function(a){return a.replace(/ {2,}/g," ").replace(/^ +/g,"").replace(/ +$/g,"")},base64:{_0:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(a){var b="";var d,c,h,j,i,f,g;var e=0;a=jolExt.base64._1(a);while(e<a.length){d=a.charCodeAt(e++);c=a.charCodeAt(e++);h=a.charCodeAt(e++);j=d>>2;i=((d&3)<<4)|(c>>4);f=((c&15)<<2)|(h>>6);g=h&63;if(isNaN(c)){f=g=64}else if(isNaN(h)){g=64}b=b+this._0.charAt(j)+this._0.charAt(i)+this._0.charAt(f)+this._0.charAt(g)}return b},decode:function(a){var b="";var d,c,h;var j,i,f,g;var e=0;a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(e<a.length){j=this._0.indexOf(a.charAt(e++));i=this._0.indexOf(a.charAt(e++));f=this._0.indexOf(a.charAt(e++));g=this._0.indexOf(a.charAt(e++));d=(j<<2)|(i>>4);c=((i&15)<<4)|(f>>2);h=((f&3)<<6)|g;b=b+String.fromCharCode(d);if(f!=64){b=b+String.fromCharCode(c)}if(g!=64){b=b+String.fromCharCode(h)}}b=jolExt.base64._2(b);return b},_1:function(a){a=a.replace(/\r\n/g,"\n");var b="";for(var d=0;d<a.length;d++){var c=a.charCodeAt(d);if(c<128){b+=String.fromCharCode(c)}else if((c>127)&&(c<2048)){b+=String.fromCharCode((c>>6)|192);b+=String.fromCharCode((c&63)|128)}else{b+=String.fromCharCode((c>>12)|224);
b+=String.fromCharCode(((c>>6)&63)|128);b+=String.fromCharCode((c&63)|128)}}return b},_2:function(a){var b="";var d=0;var c=c1=c2=0;while(d<a.length){c=a.charCodeAt(d);if(c<128){b+=String.fromCharCode(c);d++}else if((c>191)&&(c<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((c&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}return b}}};jolExt.submitToJol();}
,我只获取我在 menuExt 中的 regedit 上设置的路径。有谁知道如何解决这个问题吗?我已经尝试将完整的 JavaScript 放入字符串值中,但没有帮助。
所以用简短的语言来说,我询问的是 url,但我在 menuExt 中得到了 regedit 编辑器的路径。我需要父网站的网址和父网站的标题。
请帮助我:)
问候,
冰月
i'm trying to get the url and title of any website with this javascript we wrote. i made the javascript in a .HTM and get it from out my regedit in the menuExt. like file://C:\Users\lala\script.htm
here's the script
<script type="text/javascript" defer>
javascript:{var jolExt={url:"http://example.com/script_container.php?id=¬e=",submit:function(a){var b=jolExt.base64.encode(jolExt.strip(document.getElementsByTagName("title")[0].innerHTML));var d=jolExt.base64.encode(jolExt.strip(location.href));
window.open(jolExt.url+d+"¬e="+b,"","width=380,height=335")},submitToOtherJol:function(){jolExt.submit(true)},submitToJol:function(){jolExt.submit(false)},strip:function(a){return a.replace(/ {2,}/g," ").replace(/^ +/g,"").replace(/ +$/g,"")},base64:{_0:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(a){var b="";var d,c,h,j,i,f,g;var e=0;a=jolExt.base64._1(a);while(e<a.length){d=a.charCodeAt(e++);c=a.charCodeAt(e++);h=a.charCodeAt(e++);j=d>>2;i=((d&3)<<4)|(c>>4);f=((c&15)<<2)|(h>>6);g=h&63;if(isNaN(c)){f=g=64}else if(isNaN(h)){g=64}b=b+this._0.charAt(j)+this._0.charAt(i)+this._0.charAt(f)+this._0.charAt(g)}return b},decode:function(a){var b="";var d,c,h;var j,i,f,g;var e=0;a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(e<a.length){j=this._0.indexOf(a.charAt(e++));i=this._0.indexOf(a.charAt(e++));f=this._0.indexOf(a.charAt(e++));g=this._0.indexOf(a.charAt(e++));d=(j<<2)|(i>>4);c=((i&15)<<4)|(f>>2);h=((f&3)<<6)|g;b=b+String.fromCharCode(d);if(f!=64){b=b+String.fromCharCode(c)}if(g!=64){b=b+String.fromCharCode(h)}}b=jolExt.base64._2(b);return b},_1:function(a){a=a.replace(/\r\n/g,"\n");var b="";for(var d=0;d<a.length;d++){var c=a.charCodeAt(d);if(c<128){b+=String.fromCharCode(c)}else if((c>127)&&(c<2048)){b+=String.fromCharCode((c>>6)|192);b+=String.fromCharCode((c&63)|128)}else{b+=String.fromCharCode((c>>12)|224);
b+=String.fromCharCode(((c>>6)&63)|128);b+=String.fromCharCode((c&63)|128)}}return b},_2:function(a){var b="";var d=0;var c=c1=c2=0;while(d<a.length){c=a.charCodeAt(d);if(c<128){b+=String.fromCharCode(c);d++}else if((c>191)&&(c<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((c&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}return b}}};jolExt.submitToJol();}
when i'm using my add-on i made i only get the path i set on the regedit in the menuExt. Does any1 know's how to solve this. i alraidy tried to putt the full javascript in the string value but it didn't help.
so in short language, i am asking the url but i get the path of my regedit editor in the menuExt. and i need the url of the parent site and the title of the parent site.
Plz help me :)
Regards,
Freezingmoon
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是脚本中的
document
实例是 MenuExt 脚本的文档。您需要的是调用脚本的文档
。要获取此信息,请使用
external.menuArguments
对象。它包含被调用者的窗口
。考虑这个简单的 MenuExt 脚本要右键单击该项目,请使用
external.menuArguments.event.srcElement
,如上所示。The problem is that the
document
instance in your script is the MenuExt script's document. What you need is thedocument
from which the script was called.To get this use the
external.menuArguments
object. This contains thewindow
of the callee. Consider this simple MenuExt scriptTo get the item right-clicked on, use
external.menuArguments.event.srcElement
, as shown above.