Clipboard.js is working well in Chrome (v50.0), but won't copy text on Firefox (v46.0).
clipboard.on('error', function(e){...}) is being thrown, and clipboardjs is supported on v41+, but the error provides no information beyond providing which button was clicked to trigger the copy.
Any ideas what could be happening here or what I could check/try?
in the documentation it says that it's not supported in safari
Although copy/cut operations with execCommand aren't supported on
Safari yet (including mobile), it gracefully degrades because
Selection is supported.
That means you can show a tooltip saying Copied! when success event is
called and Press Ctrl+C to copy when error event is called because the
text is already selected.
For a live demonstration, open this site on Safari.
to get information about what was clicked check the trigger
clipboard.on('error', function(e) {
console.error('Action:', e.action);
console.error('Trigger:', e.trigger);
});
Related
I've encountered a Safari-specific JS issue in a page I'm locally developing, so I need to use the Safari Web Inspector.
In Safari Version 13.1.1, when I open the inspector and select Develop > Show JavaScript Console and start entering JavaScript, I don't get any output and the JavaScript is not executed (e.g. an alert does not fire).
On any other page, the safari JS console works just fine for me. Here's an example of normal behavior, on stackoverflow.com:
Note: the Safari JS console on other locally developed pages are working just fine.
What could possibly be causing this?
As other users mentioned, opening the page in a new tab fixes this, but you can also just close the Javascript console (clicking the 'x' in the console window) and re-open it.
Less than ideal, but if you reopen the file on a new tab, the new console works.
I get this error. often, this is because I occasionally repeat something way too many times, so that it just stops executing the console, I believe to prioritize other code. my fix is to re-open the page, and even though re-loading sounds like it works, it doesn't always.
I have a simple set of HTML and JS which when I test it directly as a web page, loaded locally from the file system in Chrome, works fine. I can click a button causing a call to navigator.bluetooth.requestDevice. This correctly causes the usual window to appear and it lists the expected Bluetooth peripheral. I can then select it and successfully pair, with my code receiving the expected callback.
If I try to execute the same html/js as a Chrome app, with a manifest and invoked from chrome://extensions the requestDevice window appears and lists the expected peripheral with the Pair button disabled. If I select the peripheral, the Pair button becomes enabled but if I click it, the window disappears into the background, behind Chrome and nothing else happens that I can see. My code receives no callback. It looks like the call was competely ignored.
What do I need to do to make this work within a Chrome app?
Thanks
Chrome Apps and Extensions should be able to use Web Bluetooth. This is a bug. I've filed chromium issue 751819.
As a work around, create the Chrome App window larger than the device chooser dialog that pops up.
I have a button which posts back through Ajax. I tried to find out what code executes when the button is clicked. I used Visual Event (screen capture below) to see how the event was bound but the info didn't help me enough. Then I set an event listener breakpoint on mouse clicks in Chrome. The breakpoint hit code in the main jQuery file which was also not helpful. So I blackboxed the file. Now when I click the button, no breakpoints are hit.
What's a systematic way to find the user code which gets executed? I also searched for 'live' and 'click' as text across the whole app. It was time consuming and didn't find where the click event for the button got attached. It's painful to do such a search. I would like to know the productive technique using Chrome's debugger or another tool. (Another browser's tips are OK)
Have you tried the Chrome profiler?
Launch the Chrome DevTools (F12)
Go to the Profiles panel
Ensure that Collect JavaScript CPU Profile is selected
Click Start
Perform your operation
Click Stop.
Then you should see a list of functions that were called.
There are several possible ways to do so. One is described by the user thesentiment. Another way is to use the DevTools' debugger.
Open the Chrome DevTools (F12)
Switch to the Sources panel
Click the Pause button () or hit F8
Perform your operation
=> The script execution will stop at the first line of the event handler function within jQuery. You can then step through to your actual event handling function.
Note that in Firebug this works much easier, because its Events side panel already displays the wrapped listeners, i.e. the functions that are called by a jQuery event listener:
I'm writing an automated test against a Salesforce site. I'm using Firefox version 21.0 and Selenium version 2.33.0.
During the test, I have a couple of alerts to deal with (with one "okay" button) and do so successfully. The alerts behaves normally.
Later in the test, in a table, there is a delete link. When it is clicked, an alert appears saying "Are you sure?" with two options, OK and Cancel. Clicking OK should delete that row in the table.
But when I run the automated test, after clicking on the link, the alert very quickly flashes on and then disappears. The row has not been deleted. It is there and has a blue background (as it does when the mouse is hovered over the row). The popup disappearing is nothing to do with the code that follows clicking the link, as I have tried putting a big sleep in between and it still happens.
I am running the test in Firefox, could it be an issue with firefox? I tried running it in Chrome instead, but then the test keeps failing at an earlier point because it cant find an element which firefox can.
Below is the method I run to handle alerts. But I don't think the problem is to do with this, because it happens before this code is run. This method runs immediately after the clicking of the link...
private void acceptAlert() {
String mainWindow = webdriver.getWindowHandle();
WebDriverWait wait = new WebDriverWait(webdriver, 20);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = webdriver.switchTo().alert();
alert.accept();
webdriver.switchTo().window(mainWindow);
}
Several times I got into conditions my scripts threw alerts in high rates. While there is an alert modal window open, you can't do any other action in the browser. I am looking to develop an add-on that will enable me to kill or suspend the "thread" the alert modal window belongs to.
In What direction should I look?
If you're using alert(); for debugging purposes maybe look for a logger instead?
If you perhaps use Firebug for Firefox (which you should imo) you can make use of the console.log() or .debug() methods to log directly to the Firebug console.
Maybe this could help?
How to stop javascript alert from showing after pressing ok