Run local exe file from href link and SharePoint Top Navigation

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

<script>
function LaunchApp() {
if (!document.all) {
alert (“Available only with Internet Explorer.”);
return;
}
var ws = new ActiveXObject(“WScript.Shell”);
ws.Exec(“C:\\Windows\\notepad.exe”);
}
</script>

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

http://sharepoint.stackexchange.com/questions/50166/run-or-open-exe-files-from-a-sharepoint-document-library

http://www.olavaukan.com/2010/02/using-activex-to-launch-desktop-applications-from-sharepoint/

javascript: if ( confirm(‘This web site is external to the company and may not be safe!’) ) document.location=’http://www.google.com&#8217;;

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.

http://techtrainingnotes.blogspot.in/2010/10/sharepoint-javascript-in-quick-launch.html

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

http://blog.mastykarz.nl/programmatically-configuring-menu-items-sharepoint-2010/

http://sharepointryan.com/2013/04/15/fix-sharepoint-quick-launch-links-using-powershell/

http://kishorspoint.wordpress.com/2013/03/15/add-heading-and-links-to-the-global-navigation-using-powershell/

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: