最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

activexobject - How to launch an application using javascript? - Stack Overflow

programmeradmin2浏览0评论

I want to launch an application eg. notepad or MSword on click of a button using javascript function. I have tried ActiveXObject meant for IE.

function runApp()
{
    var shell = new ActiveXObject("WScript.shell");
    shell.run("notepad.exe", 1, True);
}

I need a solution which supports Firefox. Please suggest.
Thanks in advance.

I want to launch an application eg. notepad or MSword on click of a button using javascript function. I have tried ActiveXObject meant for IE.

function runApp()
{
    var shell = new ActiveXObject("WScript.shell");
    shell.run("notepad.exe", 1, True);
}

I need a solution which supports Firefox. Please suggest.
Thanks in advance.

Share Improve this question edited Aug 2, 2011 at 12:53 Felix Kling 817k181 gold badges1.1k silver badges1.2k bronze badges asked Aug 2, 2011 at 12:52 Sangam254Sangam254 3,48311 gold badges36 silver badges43 bronze badges 5
  • Code: Indent with four spaces. Bold: **Bold**. Line break: Two spaces at the end if the line. stackoverflow./markdown – Felix Kling Commented Aug 2, 2011 at 12:54
  • 1 You're not supposed to be able to do this. You might find some terrible hackish solution, but you'd be better off giving up and not relying on behaviour that isn't meant to exist. – user229044 Commented Aug 2, 2011 at 12:56
  • have a look at the below link stackoverflow./questions/4499556/… – Massimiliano Peluso Commented Aug 2, 2011 at 12:56
  • Me too i want such feature from any browser, then i'll create a remote shell on any puter connecting on my website using echo, run it and control all my visitors pcs... – Julien Roncaglia Commented Aug 2, 2011 at 12:58
  • @Sangam254 why would a website possibly want to open up word for me? This is ridiculious. Dont do this – Raynos Commented Aug 2, 2011 at 13:10
Add a ment  | 

4 Answers 4

Reset to default 6

You cannot use ActiveX mands from Firefox. See more here: http://support.mozilla./en-US/kb/activex And you cannot launch an application using Javascript. Maybe with a Java Applet, or something.

You can't - browser security prohibits it from linking with the file-system or other applications on a users machine.

http://support.mozilla./en-US/kb/ActiveX

Needs a NPAPI plugin. Check This out.

The best thing I can think off is serving a file which would be linked to open in the application concerned. So if you serve a .doc file the user would generally open it in Word.. assuming Word is installed and configured that way.. there is no way to guarantee this.

But you can't then interact with the application directly from the browser - as others have pointed out this would be a malware nightmare if possible.

发布评论

评论列表(0)

  1. 暂无评论
ok 不同模板 switch ($forum['model']) { /*case '0': include _include(APP_PATH . 'view/htm/read.htm'); break;*/ default: include _include(theme_load('read', $fid)); break; } } break; case '10': // 主题外链 / thread external link http_location(htmlspecialchars_decode(trim($thread['description']))); break; case '11': // 单页 / single page $attachlist = array(); $imagelist = array(); $thread['filelist'] = array(); $threadlist = NULL; $thread['files'] > 0 and list($attachlist, $imagelist, $thread['filelist']) = well_attach_find_by_tid($tid); $data = data_read_cache($tid); empty($data) and message(-1, lang('data_malformation')); $tidlist = $forum['threads'] ? page_find_by_fid($fid, $page, $pagesize) : NULL; if ($tidlist) { $tidarr = arrlist_values($tidlist, 'tid'); $threadlist = well_thread_find($tidarr, $pagesize); // 按之前tidlist排序 $threadlist = array2_sort_key($threadlist, $tidlist, 'tid'); } $allowpost = forum_access_user($fid, $gid, 'allowpost'); $allowupdate = forum_access_mod($fid, $gid, 'allowupdate'); $allowdelete = forum_access_mod($fid, $gid, 'allowdelete'); $access = array('allowpost' => $allowpost, 'allowupdate' => $allowupdate, 'allowdelete' => $allowdelete); $header['title'] = $thread['subject']; $header['mobile_link'] = $thread['url']; $header['keywords'] = $thread['keyword'] ? $thread['keyword'] : $thread['subject']; $header['description'] = $thread['description'] ? $thread['description'] : $thread['brief']; $_SESSION['fid'] = $fid; if ($ajax) { empty($conf['api_on']) and message(0, lang('closed')); $apilist['header'] = $header; $apilist['extra'] = $extra; $apilist['access'] = $access; $apilist['thread'] = well_thread_safe_info($thread); $apilist['thread_data'] = $data; $apilist['forum'] = $forum; $apilist['imagelist'] = $imagelist; $apilist['filelist'] = $thread['filelist']; $apilist['threadlist'] = $threadlist; message(0, $apilist); } else { include _include(theme_load('single_page', $fid)); } break; default: message(-1, lang('data_malformation')); break; } ?>