Launch an application using HTML - html

I know that
<a href = 'ymsgr:sendim?contactID'>Send me a message</a>
will launch Yahoo Messenger.
can I create something like this to launch MSWord or my own application?

Here is an explanation of what you're describing: https://stackoverflow.com/a/16586294/4500419
And here you can find the URI specifications for Microsoft Office:
https://msdn.microsoft.com/en-us/library/office/dn906146.aspx#sectionSection4
So, something like
ms-word:ofv|u|http://yoursite.com/document.docx
Would open document.docx in read-only mode in MS Word.
And here's the doc on how to register your own application to a URI scheme in Windows:
https://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx

This works also by simply naming the html file .hta which is fine if its for a local project
<html>
<head>
<title>Application Executer</title>
<HTA:APPLICATION ID="oMyApp" APPLICATIONNAME="Application Executer" BORDER="no" CAPTION="no" SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" SCROLL="no" WINDOWSTATE="normal">
<script type="text/javascript" language="javascript">
function RunFile() { WshShell = new ActiveXObject("WScript.Shell"); WshShell.Run("c:/windows/system32/notepad.exe", 1, false); }
</script>
</head>
<body>
<input type="button" value="Run Notepad" onclick="RunFile();"/>
</body>
</html>

Related

Google SaveToDrive code works only for localhost and does not respond for server/domain name

I am trying to add a saveto drive button to my website. Following sample code works if the url in the browser is typed as "localhost" and FAILS or nothing happens, no error when used with the server name or domain name.
<!DOCTYPE html>
<html>
<head>
<title>Save to Drive of exported PDF: Async Load with Language</title>
<link rel="canonical" href="http://global.com">
</head>
<body>
File 1 Emp 5::
<div class="g-savetodrive"
data-src="./pdfGen.jsp?selEmp=5"
data-filename="Emp5.pdf"
data-sitename="Sample Application">
</div>
<BR/><BR/>
File 2 Emp 6::
<div class="g-savetodrive"
data-src="./pdfGen.jsp?selEmp=6"
data-filename="Emp6.pdf"
data-sitename="Sample Application">
</div>
<script type="text/javascript">
window.___gcfg = {
lang: 'en-US'
};
</script>
<script>
window.onLoadCallback = function(){
gapi.auth2.init({
client_id: "<CreatedApplication Key>.apps.googleusercontent.com"
});
}
</script>
</body>
</html>
Have created a project in google console, Created credentials clientkey, set the project to Testing/developer mode.
When accessed the application as "http://localhost:8180/Sample/gDrive.html" or "http://localhost:8180/Sample/gDrive.jsp",It's working fine. But,
"http://devsys.mtv.global.com:8180/Sample/gDrive.html", the buttons are rendered and on clicking that, no error is thrown, nothing happens. Very disgusting.
Any help is appreciated. Thank
Be sure to add the Authorized JavaScript Origin
More information can be found here:
https://developers.google.com/identity/protocols/oauth2/javascript-implicit-flow

ActiveXObject for Chrome or FF not for IE

Instead of ActiveXobject what i have to use for Chrome or FF.
Below code is not working on Chrome and FF.
i am getting the below error
"Uncaught ReferenceError: ActiveXObject is not defined".
<!DOCTYPE html>
<html>
<head>
<title>Application Executer</title>
<HTA:APPLICATION ID="oMyApp"
APPLICATIONNAME="Application Executer"
BORDER="no"
CAPTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
SCROLL="no"
WINDOWSTATE="normal">
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/vlc-2.2.4-win64.exe", 1, false);
}
</script>
</head>
<body>
<input type="button" value="Run Notepad" onclick="RunFile();"/>
</body>
</html>
There is no cross-browser way to trigger the execution of applications on the user's system from an HTML document.

why this code is not create a file in html5

i want to create a 'abc.txt' file in the folder where the .html file exist. in html5.
i tri with this code:
<html>
<head>
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<script type="text/javascript">
function onInitFs(fs) {
fs.root.getFile('abc.txt', {create: true, exclusive: true}, function(fileEntry) {
}, errorHandler);
}
window.requestFileSystem(window.TEMPORARY, 1024*1024, onInitFs, errorHandler);
</script>
<input type="button" name="" id="" value="click" onclick="onInitFs(fs);"/>
</body>
</html>
But faild. Please tell me the correct method. (i tri with google chrome and letest firefox.)
From the documentation:
The LocalFileSystem interface of the File System API gives you access to a sandboxed file system.
It doesn't give you access to the main filesystem for the computer. It is a virtual one created by the browser. You can only access files in it that you put there from your own code.

Dojo 1.7 form setFormValues during startup

Being new to Dojo I'm trying to initialize a Dijit form with values, e.g. read from storage, XHR etc.
However, invoking form.setFormValues() causes an error TypeError: invalid 'in' operand this.formWidgets thrown by http://yandex.st/dojo/1.7.3/dojox//form/manager/_Mixin.js
Is there anything I'm doing wrong or is this a Dojo issue? (The complete sample is also found here: http://pastebin.com/7LUHr3iA)
<!-- language-all: lang-html -->
`
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.3/dijit/themes/claro/claro.css" media="screen">
<script type="text/javascript">
dojoConfig = {async: true,parseOnLoad: true};
</script>
    <script type="text/javascript" src="http://yandex.st/dojo/1.7.3/dojo/dojo.js"></script>
<script type="text/javascript">
require(["dijit/form/TextBox","dijit/form/Button","dojox/form/Manager",
"dojo/parser","dojo/dom","dijit/registry"], function () {});
</script>
</head>
<body class="claro">
<form id="myForm" method="post" data-dojo-type="dojox.form.Manager">
<label for="name">Name</label>
<input id="name" name="nameField" data-dojo-type="dijit.form.TextBox"/><br/>
<label for="surname">Surname</label>
<input id="surname" name="surnameField" data-dojo-type="dijit.form.TextBox"/><br/>
<button data-dojo-type="dijit.form.Button">Submit</button>
<script type="dojo/method" event="startup">
var form = dijit.byId("myForm");
form.setFormValues({
nameField: "Hello",
surnameField: "World"
});
</script>
</form>
</body>
</html>
`
Dojo 1.7 is asynchronous. Code should take the form:
require(["dependency"], function(dep) {
// use dependency
});
There is no reason to believe dojox/form/Manager would be loaded when you try to reference it further down the page.
The registry is the correct way to reference the widget, not 1.6 style code of the form dijit.byId. See livedocs.
See also the dojo/domReady! plugin.

SAP UI5: object expected error in IE

i am using SAP UI5 and don't know why is it showing object expected in line 347 while running index.html file in ie.
<html>
<head>
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<script src="resources/sap-ui-core.js"
type="text/javascript"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons,sap.ui.ux3"
data-sap-ui-theme="sap_goldreflection" >
</script>
<script type="text/javascript" src="OPM_CM.js"></script>
<script>
sap.ui.localResources("opm");
var view = sap.ui.view({id:"OPM_CM1", viewName:"opm.OPM_CM", type:sap.ui.core.mvc.ViewType.JS});
//view.placeAt("content");
buildShell();
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
thanks in advance.
This may be happening because the sap object is not available.
<script>
function init(){
sap.ui.localResources("opm");
var view = sap.ui.view({id:"OPM_CM1", viewName:"opm.OPM_CM", type:sap.ui.core.mvc.ViewType.JS});
//view.placeAt("content");
buildShell();
}
window.addEventListener('load',init);
</script>
adding your code to a function and calling it on body onload may do the trick.
Note: please also give more details about the error you are getting.