application executer, desktop icons - html

i would like to run .exe files on my computer from my website,
example:
<script type="text/javascript" language="javascript">
function RunFile() {
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
}
</script>
<input type="button" value="Run Notepad" onclick="RunFile();"/>
I googled this and its seems its only possible in IE so i wonder if its possible to do this in all browsers with some sort of application like BF3 or something, a handler of some sort .dll or whatever they use.
I will not abuse this, i can assure you i will only use it for my personal usage and with some friends. I want a html file that can open desktop icons.

The ActiveXObject is not part of HTML DOM nor JavaScript/ECMAScript standard. It is only available for Microsoft Internet Explorer (MSIE). MSIE for Mac might also lack support of ActiveXObject since ActiveX is Window platform originated.

There is no way to launch local applications from web pages. As you've no doubt surmised, it's far too easy to abuse.

Related

why do I get a black page? [duplicate]

I tried the following HTML page with two scripts:
<html>
…
<body>
<script type="text/javascript">
alert ('Javascript');
</script>
<script type="text/vbscript">
msgbox "Vbscript"
</script>
</body>
</html>
On Windows 8.1 preview + Internet Explorer 11, the JavaScript worked, the VBScript did not.
On (Windows 8 + IE10), (Windows 7 + IE9), the two scripts worked.
I did not find any information about the end of VBScript support in Internet Explorer 11, did you?
The IE team has been trying to retire VBScript for years.
http://msdn.microsoft.com/en-us/library/windows/apps/Hh700404.aspx indicates that support was removed from the ExecScript API. http://msdn.microsoft.com/en-us/library/ie/dn384057(v=vs.85).aspx explains that it's removed from IE11 Edge mode in the Internet Zone.
If you add the following to your HEAD tag, your VBScript will run:
<meta http-equiv="x-ua-compatible" content="IE=10">
It actually very simple.
Only IE 10 and older supports VBScript. However you can easy change compatibility mode on IE 11 to IE 10 and it works perfectly fine.
I had the same issue: an old web site developed in 2004 using ASP and VBScript and the following procedure was the solution for me.
In order to change compatibility mode in IE 11 :
Press F12 to open developer tools
In left toolbar scrool down until you see "Emulation" settings page
Change Document Mode from default ("Edge") to 10
Enjoy your VBScript
Actually I just had the same issue and found the resolution for myself. I also tried the way that EricLaw described but that didn't work for me. Here is what I found:
Open your website, go to Tools --> Compatibility View Settings, and then click Add (the website you are on should show in the form automatically), and you should be able to see the result.
Another possible solution is to use HTA files
I was struggling to save a tool that use simple HTML interface to survive our company migration from IE8 to IE11, and after a lot of investigation, this simple solution was found: rename files from file.html to file.hta
it is then openned by Microsoft HTML application host, which still support VBscript.
Downside is that not all CSS format are supported, but it's really easy to use this solution
This is probably part of Microsoft's effort to make IE11 look like a standard browser.
IE11 removes all existing ways to check whether it's IE (other than actual specific feature detection that IE11 doesn't support yet).
The idea is that IE now works enough like a standard browser that any existing code with special cases for IE should no longer apply.
Checking for VBScript support is simply one of those obsolete checks that Microsoft wants to prevent.
Try this HTA code:
<html><head>
<HTA:APPLICATION
ID = "testHTA"
APPLICATIONNAME = "testHTA"
VERSION = "0.1"
NAVIGABLE = "yes"
SHOWINTASKBAR = "yes"
SINGLEINSTANCE = "yes"
WINDOWSTATE = "normal"
BORDER = "normal"
BORDERSTYLE = "normal"
INNERBORDER = "no"
CAPTION = "yes"
MINIMIZEBUTTON = "yes"
MAXIMIZEBUTTON = "yes"
SYSMENU = "yes"
SCROLL = "yes"
SCROLLFLAT = "yes"
CONTEXTMENU = "yes"
SELECTION = "yes"
/>
</head>
<script language="javascript" type="text/javascript">
function MyJsAlert() {
alert('Hello world! Opening notepad now...');
}
</script>
<script language="VBScript" type="text/vbscript">
MyJsAlert() 'executes javascript
' Create a Windows Shell object
set oShell = CreateObject("WScript.Shell")
oShell.CurrentDirectory = "c:\CAMEO\webapps\"
oShell.run("c:\windows\system32\notepad.exe")
</script>
</body></html>
Save the above code as an HTA file (i.e., test.hta), and launch in IE. This code mixes javascript and vbscript, and works in IE 11.

Issue with Phonegap in app browser

So I have been trying to load http://yahoo.com in a phonegap application. So when user opens the app, it automatically shows yahoo website as an app. Everything I do I'm still getting phonegap splash page and don't really know what else to do. Documentation on phonegap doesnt make sense, its confusing and in addition to that Cordova and Phonegap versions (in references) are wrong version.
Can you please put me in a right direction with a dummy guide to achieve this? I have done this last year but couldnt find my test app any more.
Thank you all.
You want to load yahoo page inside your application and open the yahoo page as soon as your application is opened. Right?
To do this create a phonegap application. Assuming you know how to do it.
Add inAppBrowser plugin.
Then inside the device ready event,write this code.
<script type="text/javascript" src="cordova.js"></script>
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady()
{
window.open("http://www.yahoo.com",'_self',"location=no");
}
</script>

Firefox and Speech Synthesis API

I'm creating HTML5 Speech Synthesis application like below link.
http://updates.html5rocks.com/2014/01/Web-apps-that-talk---Introduction-to-the-Speech-Synthesis-API
Windows7 and Android Chrome33beta or Mac's safari works fine.
but Windows7-Firefox 27 seems support Speech-Synthesis-API,but not work because return empty voice list.
Is there any solution?
Check if Speech Synthesis API is supported your browser
http://caniuse.com/#feat=speech-synthesis
You can check it with modernizr
http://v3.modernizr.com/download/#-speechsynthesis
If browser not support it, you can use meSpek.js
http://www.masswerk.at/mespeak/
Unfortunately, it looks like only Firefox OS (and perhaps also, Firefox for Android, I have not checked) bundles and supports a speech synthesis library.
There is an open bug regarding desktop support.
As of release 44, the Speech Synthesis half of the api is available on Firefox Desktop.
But weirdly still requires that the flag be set. Under "Browser Compatibility":
Can be enabled via the media.webspeech.synth.enabled and media.webspeech.recognition.enable flags in about:config. Note that currently only the speech synthesis part is available in Firefox Desktop — the speech recognition part will be available soon, once the required internal permissions are sorted out.
I wonder why. MDN has even gone to the trouble of whipping up some nice working examples, why not have the functionality enabled be default?
If you just want to add a button to your webpage to read the page out loud, add this code to your website:
<script src='https://code.responsivevoice.org/responsivevoice.js'></script>
<script type="text/javascript">
<!-- //
var speechpause=0;
function toggleSpeech(){
if(speechpause!=1){
responsiveVoice.pause();
speechpause=1;
}else{
responsiveVoice.resume();
speechpause=0;
}
}
//-->
</script>
<div style="float:right">
<input onclick="responsiveVoice.speak($('#some_div_with_content').text(), 'Deutsch Female', {pitch: .7});" type="button" value="🔊 Play" />
<input onclick="toggleSpeech()" type="button" value="||" />
</div>
This uses jquery to get the text of the content, but that could be easily changed.

Could I embed a link to display a PDF in a browser, rather than induce a download?

I would like customers to my website be able to click on a url/button on my website, and then have the url/button open a submittable PDF IN THE BROWSER, rather than induce a download. Not sure on the code specifics that need to be added to make the PDF display in the browser, rather than be queued into active downloads...Thank you
Best,
SL
Try something like this
<iframe id="myFrame" style="display:none" width="600" height="300"></iframe>
<input type="button" value="Open PDF" onclick = "openPdf()"/>
<script type="text/javascript">
function openPdf()
{
var omyFrame = document.getElementById("myFrame");
omyFrame.style.display="block";
omyFrame.src = "2.pdf";
}
</script>
Hope it helps
Time ago, when I had to solve the same problem, the issue came when some users didn´t have installed the Adobe (or other PDF viewer) plug-in in their browser.
Just keep it in mind and maybe it´s interesting to provide a link to download the PDF Viewer of your preference.
I think, no special code is required on your side. The browser will take care but likely you cannot forcé the user to view it on the browser and not download. He will always have the option to choose. If you really want to avoid that you should look at the options your PDF is generated with.

HTML5 drag-drop uploads

Does anybody know how to use HTML5 to achieve uploads by drag-drop files form desktop?
I have found the following references:
Selecting files using drag and drop (2017-08) on developer.mozilla.org
Drag and drop file uploading using JavaScript the article states that the api was changed and links to The File Api has changed (2010-09)
html5-drag-and-drop-multiple-file-upload (2017-11 returns 404) on http://www.appelsiini.net/ (is still live)
but is there a solution that can run on all platforms: Firefox, Chrome and Safari?
Many thanks!
Sorry, at the moment there is no cross browser solution available.
Current Browser Implementation Issues
FF, Safari, Chrome, IE (Cross-Browser Issues)
No recursive folder uploading -- as a matter of fact, no folder uploading at all. While this isn't a show stopper, it does seem kind of silly to allow a user to select a folder in the file upload input box if the browser won't send all the files inside that folder too.
Firefox 3.6.*
This browser supports file drag and drop, however the implementation is quite possibly the worst ever conceived. In order to upload a file that the user dropped, we have to read the entire file into memory and then send it over Ajax to our servers. This works fine for drops of around 10MB. If you try that same operation with a 400MB file, forget it!
Firefox 4.* (Beta)
The Mozilla developers are quick ones -- they realized the problem with their previous implementation and have created a whole new way to implement drag and drop uploading. The FormData object is a new JavaScript object that allows a web developer to insert file uploads directly into an Ajax request without reading the files into memory first. I was really excited about this and promptly downloaded Firefox 4 which is in its 2nd beta. After playing around with it for less than 5 minutes, I strongly discourage you from trying it yet. My system became incredibly unstable and slow and development was a major pain due to lack of support for Firebug.
Chrome (latest)
This browser is by far the best in its implementation! Simple and straightforward, my only complaint here is that you can't upload a folder and its contents via drag and drop.
Safari 4.* & 5.*
Since Safari is built on top of WebKit just like Google Chrome, I expected it to work just as well. Wow, was I mistaken! I tried this in both Safari 4 and Safari 5. While dragging and dropping multiple files into the window works, Safari sends the first file multiple times, instead of sending all the files. Talk about a MAJOR bug. To make it even more interesting, if the user clicks on the drop location, they can select multiple files to upload using the standard file selection dialog -- and that works as expected! I can't wait for Safari to fix this issue.
Internet Explorer
To be honest, I haven't even bothered trying to do drag and drop uploads in Internet Explorer yet. Trying to support IE is a pain due to lack of good development tools and a non-conforming JavaScript engine. Since I haven't been able to get all the preferred browsers to play nice, I can't imagine Internet Explorer will be even close.
source
I would defiantly look into running Plupload. It allows great browser capability and supports multiple file drag and drop in HTML5 browsers that support FileReader.
So lets say for example you dont have html 5 it will deprecate down to flash / gears / silverlight depending on what that individual has installed.
Here's the compatibility chart:
http://www.plupload.com/index.php
It has an option called droparea: "somediv" that allows you to drag files into it and automatically cue up a file upload.
Let me know if you need any help setting it up.
Here is a simple example. If you drag an image over the red div it appends the image to the body. I've confirmed it works in IE11, Chrome 38, and Firefox 32. See this Html5Rocks article for a more detailed explanation.
<div id="dropZone" style="width: 100px; height: 100px; background-color: red"></div>
<script>
var dropZone = document.getElementById('dropZone');
// Optional. Show the copy icon when dragging over. Seems to only work for chrome.
dropZone.addEventListener('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'copy';
});
// Get file data on drop
dropZone.addEventListener('drop', function(e) {
e.stopPropagation();
e.preventDefault();
var files = e.dataTransfer.files; // Array of all files
for (var i=0, file; file=files[i]; i++) {
if (file.type.match(/image.*/)) {
var reader = new FileReader();
reader.onload = function(e2) {
var img = document.createElement('img');
img.src= e2.target.result;
document.body.appendChild(img);
}
reader.readAsDataURL(file);
} } });
</script>