How to make the Web Bluetooth Pair button work when run as chrome app - web-bluetooth

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.

Related

Safari JavaScript Console Not Executing JS Or Showing Output On Certain Pages

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.

Open a popup (e.g. native browser) from a Teams desktop client app tab

Is there any way to pop open a browser window from a Teams app tab (desktop client)?
I came across the following link and from my interpretation of the reply it seems it's not possible.
Quoted from link for reference:
Unfortunately it’s not possible to use window.open in Teams tabs. Because we block opening of new windows to arbitrary sites within our Teams Desktop Client (for security reasons) you need to always use microsoftTeams.authentication.authenticate (if you want a popup window) or microsoftTeams.tasks.startTask (if you want an iframe-based dialog) to open a secondary app view.
It's not very clear to me what the microsoftTeams.authentication.authenticate reference above is suggesting.
Alternatively, if not a browser window, can we attempt to open another app installed on the device (e.g. Excel)?
Thanks in advance!
Are you just wanting to launch a new browser entirely? If so, a regular anchor tag, with a target attribute (e.g. ...), will work fine (I'm doing this in a tab myself, and it's working without problem).
You could try using a TaskModule to open a custom HTML/ Javascript or an iframe based widget inside a popup from within your Teams tab.
microsoftTeams.authentication.authenticate() will let you Authenticate the user against you tab. You can find the docs for this here.

How can I enable autoplay (not initiated by user) in Firefox?

I have one page that launches another page, and the launched page does a series of scrapes and then plays an audio based on the results.
This stopped working today, maybe because of a Firefox update, but I need to be able to enable auto play as it is critical that the audio plays when the launched page loads.
Here is what my current JavaScript code looks like:
function playHighRiskStock(){
var highRiskStock = new Audio('./wav/high-risk.wav');
highRiskStock.play();
}
It is now giving me the error: NotAllowedError: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
It did this all-of-a-sudden (i.e. it was working perfectly yesterday autoplaying with no problems).
How do I configure my browser to allow autoplay, even if not initiated by the user?
I have looked at this page: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide but it doesn't give any actual JavaScript code examples on setting auto play.
I got the same error in Firefox. The following fixed it for me. Didn't need a reboot or to reload the browser.
Click the Hamburger (Options Menu).
Pick the Options menu.
In the search textbox, enter "Sound".
A "Block websites from automatically playing sound" option will appear.
Either uncheck that option or click the "Exceptions" button beside it. In my case, I added an exception for https://app.pluralsight.com. It works fine now.
Another option is to use Chrome.
Good luck.

How to make Firefox debugger run in a separate window/tab?

I do wonder if it's possible to open the Firefox's (I have 18.0.1) debugger in a new window/tab as right now the debugger's pane is too small at the bottom of the page.
[Edit]
Ok, I've made a few screenshots to show that Firefox does have a debugger on its own:
Current Firefox nightlies have a little two-window icon next to the 'x' in the debugger toolbar that tears it off into a separate window, but that might not be present in 18 yet...
If you mean Firebug, these directions should be sufficient.
Click on the Firebug launch icon so the hidden submenu appears.
Hover over "Firebug UI Location"
Select "Detached"
EDIT:
Ok I see... you are using the Firefox built in Developer Tools and not Firebug.
So as far as I understand, there seems to be no way to run the JavaScript Debugger on a separate window for non-remote work. Here is a statement directly from the JS Debugger docs:
The JavaScript debugger is available in two varieties: one for
debugging content running directly in Firefox, and another that lets
you debug code running on a Firefox OS device, or in Firefox on an
Android device. The main difference between the two is that the Remote
Debugger runs in its own window, while the web content debugger runs
in the same tab as the Web content you're debugging.
Also here is a link to the Debugger's docs:
https://developer.mozilla.org/en-US/docs/Tools/Debugger
Why do you think that the Debugger view is too small? If you hover over the top bar, you can drag it up/down as much as you need to. Aslo are you sure that the JavaScript Debugger is what you're trying to use? For example Firefox has other tools as well. The "More Tools" link shows other built in tools as well - all these tools together are called the "Developer Tools". Here is a link to all of their docs: https://developer.mozilla.org/en-US/docs/Tools
I hope this makes more sense now!
Screenshot:

IE: When clicking Google +1 a new window opens and then tries to close again

I have recently introduced some Google +1 buttons to my site.
I am calling the button like this:
<g:plusone size="small"
count="false"
callback="plusone_vote"
href='http://www.mysite.com'>
</g:plusone>
The plusone_vote callback is a js function which pushes a tracking event to Google Analytics.
This works for the majority of users. However, a small number are getting an issue. When they click on the +1 link a new IE window appears and then displays the message
"The webpage you're viewing is trying to close this window.
Do you want to close this window?"
If the user clicks "No" they get they Google +1 privacy page ("I'm fine with Google using my +1's and other info around content and ads on non-Google websites"). They can then click the "Share my +1's button" and the window closes. However, they "+1" action never appears to happen. The button does not turn blue and the page does not show up in their profile.
The users were all using IE8 or IE9 on Windows 7 - a combination which works fine for most users. The only thing that appears to be the same is that they all use the same type of laptop - I'm struggling to see the significance of that though.
Any ideas?
The actual issue is with your IE security settings: the page MUST be displayed as a regular 'internet' webpage in order for IE to correctly run the +1 and Facebook Like plugins without this error message.
In order to fix this:
Go into Internet Options in the IE menu
Go to Security Settings. Click on 'local intranet'.
Click on sites. Make sure 'detect local intranet' and all it's sub checkboxes are unchecked. Go into 'advanced' and make sure your webpage's domain is not listed. Close this window.
Now, click on 'Trusted Sites' and then 'Sites'. Make sure to remove your site's domain if it's listed.
All sites which are not 'Intranet' or a 'Trusted Site' default to public internet settings, which is the same as what your users will see (unless you're writing a business application which runs for internal network users, I suppose). This should fix this pop up, and allow +1 and Facebook like plugins to function correctly.

Resources