Run local exe file from href link and SharePoint Top Navigation

<a href=”javascript:LaunchApp()”>Launch the executable</a>

function LaunchApp() {
if (!document.all) {
alert (“Available only with Internet Explorer.”);
var ws = new ActiveXObject(“WScript.Shell”);

need client setting

Client settings:

1 From internet explorer menu select: “Tools-> options”

2 In the opened window select tab “Security”

3 Select icon of relevant zone and press button “Custom level”

4 Set  option “Initialize and script ActiveX controls not marked as safe”  in group “ActiveX controls and plug-ins” to enabled.

reference from

javascript: if ( confirm(‘This web site is external to the company and may not be safe!’) ) document.location=’;;

if sharepoint server publishg feature is activated in the site collection feature the url doesn’t allow to add javascript. it only allow some uri format string such as http:// file:// …
so deactivate the feature and put the javascript into url

or use powershell script to update url.

$node = $web.Navigation.TopNavigationBar[16]
$link = $node.Children[0]
$link.Url = “javascript: alert(‘hi, it works’)”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: