Reenabling document.execCommand("cut") in Google Chrome - javascript

Is there a way to re-enable the document.execCommand("cut") Javascript method call in Google Chrome? Palm's WebOS Enyo framework uses this is a few places, which means when I'm working on applications locally I can't access every API of the framework.
Insight from all platforms welcome, but I'm working on OS X so those answers are preferred.

You are going to have to use the emulator for some functionality.
I dont know if other WebKit browsers like Safari have this ability enabled however.

Chrome does not support execCommand or clipboard interaction, which is considered a security threat.
For example, Google docs on chrome shows a "Please use CTRL+X or use your browser's edit menu" dialog when a user tries to execute cut from google docs' UI.
An experimental clipboard API is available for chrome extensions: http://code.google.com/chrome/extensions/experimental.clipboard.html#method-executeCut

Related

Changing firefox's prefs.js from browser

Before firefox's ver 57 I was using https://github.com/edabg/jsprintsetup to change the printing configuration on the fly. This is no longer possible.
Using about:config on the browser window I can change the settings I want and when opening a new tab the changes are reflected.
My question is how do I do this after version 57? Im open to developing an extension or an add-on for firefox for this. Some of the preferences I want to change is the print.{printer}.print_orientation,print.always_print_silent etc
This is used only within the companys Intranet system, so security wont be an issue.
There is no WebExtension API for preferences manipulation.
The only way out is to implement your own experiment API, but extensions with experiment API work only on Firefox Nightly and Developer Edition.

Testing CORS compatibility for IE8 using developer tools

I've set up a central WebApi site that will provide general CRUD capability for various sites across our domain. I've configured the whole shebang to utilize CORS with the standard jquery ajax httprequest or, in the case of older IE versions, XDomainRequest. So far, everything checks out, it works splendidly. My problem is that I can't seem to find a machine with IE8 in order to complete user agent testing. The site works wonderfully when I go into the developer tools on IE 11 and set it to emulate IE8 but I'm not ready to pop the champagne cork just yet.
My question is: will the developer tools' IE8 mode fully emulate that browser's behavior, down to the way it handles cross domain requests or do I need to either find a user with IE8 and have them test it or spin up a VM with it?
You can download a virtual machine with IE8 from Microsoft's modern.ie site at http://dev.modern.ie/tools/vms/ and test your site with that.

Browser Awareness of Bluetooth Beacons / iBeacons

Is there a way to make a browser aware of iBeacon devices in its proximity?
Similar to the way HTML5 Geolocation is working...
If not would this be something that can be achieved with a browser plug-in that can provide the detail to be consumed by javascript?
Unfortunately, no. No web browsers have implemented any bridges between beacon detection and JavaScript.
I don't think a plugin approach is possible on mobile browsers (either iOS or Android), because neither browser supports asynchronous communication between external apps and JavaScript in Mobile Safari / Mobile Chrome. The best you could do is have a custom app that responds to a beacon, then launches a web page in the browser. But I realize that isn't what you are asking for.
If you want to build a native app with JavaScript, you can use Cordova (aka PhoneGap) and use plugins that provide beacon support. My company has one for our ProximityKit beacon framework:
https://github.com/RadiusNetworks/proximitykit-plugin-cordova
There is also a Cordova plugin that has basic beacon support here:
https://github.com/petermetz/cordova-plugin-ibeacon
This looks promising (2016), Google Chrome developers site showing a desktop browser feature as a work in progress.
https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web?hl=en
Even though the Web Bluetooth API specification is not finalized yet,
the Chrome Team is actively looking for enthusiastic developers (I
mean you) to try out this work-in-progress API and give feedback on
the spec and feedback on the implementation.
Web Bluetooth API is currently available to be enabled experimentally
on your origin in Origin Trials, or locally on your machine using an
experimental flag. The implementation is partially complete and
currently available on Chrome OS, Chrome for Android M, Linux, and
Mac.
Go to chrome://flags/#enable-web-bluetooth, enable the highlighted
flag, restart Chrome and you should be able to scan for and connect to
nearby Bluetooth devices, read/write Bluetooth characteristics,
receive GATT Notifications and know when a Bluetooth device gets
disconnected.
https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md
There's a W3C specification for this Web Bluetooth, but there's no support yet: http://caniuse.com/#search=bluetooth.
If you decide to write a Phonegap plugin implementing this spec will be a good starting point.

How to call run/invoke a local application inside google chrome

In out local intranet, we have a website that will be only used inside our intranet.
Before we use it in internet explorer, there are lots of page using JavaScript + ActiveX to open local applications, like Microsoft excel etc.
Now we want to shift to using Google Chrome, but we don't know to call these applications inside Chrome.
Is it possible to do in Google Chrome? Or is there any extensions of Chrome can do it?
You can do it with NPAPI Plugins: "You can bundle an NPAPI plugin with your extension, allowing you to call into native binary code from JavaScript."
I have seen the new desktop notification from google, that does work really outside the browser, so you can have look on its concepts and try to mimic its techniques!
You could check out Native Client SDK for Google Chrome.

Debugging Web-Applications on Android [duplicate]

I'm developing a JavaScript application that needs to run on the Google Android Phone OS. Is there a way to enable the JavaScript Error/Debug console within Safari on either the Android Emulator or an actual device? If so any instructions on how to do so would be appreciated.
It looks like, with the Android 2.0.1 SDK you'll need to filter on "browser" instead of "WebCore"
A quick Google turns up this blog post (posted after you asked your question), that should at least let you see any Javascript errors via the Android Debug Bridge using the command:
adb logcat WebCore:V *:S
Not quite the same as a full debug console though.
On Android write about:debug on the address line when the current page is the page you want to debug. you will get access to the console.
I know your question is about Safari, but you might want to look into using Chrome instead. You can now use Chrome's desktop developer tools to debug and profile apps on your Android device.
Here's how:
On Android Chrome, go to settings -> Developer tools and check "Enable USB Web debugging"
On the desktop, run adb forward tcp:9222 localabstract:chrome_devtools_remote
Now on Desktop Chrome, navigate to localhost:9222.
You should see a list of the pages you have open on your phone. Click the one you want to debug/profile.
Detailed instructions are here
I have discovered that you can get this debugging information on the phone itself, without needingn to use adb or plug it into a computer, just download a log viewer.
Check the link for more info.
You can view the log and much more with weinre
From the Weinre docs
weinre is a debugger for web pages, like FireBug (for FireFox) and Web Inspector (for WebKit-based browsers), except it's designed to work remotely, and in particular, to allow you debug web pages on a mobile device such as a phone.

Categories