I have set my Cocoa app to be an URL handler for com_example_myapp: protocol (using this great tutorial). So, the link in Safari <a href="com_example_myapp://link"> now opens my app. Cool.
But before I give the user the link in the web browser, how can I determine whether the client's OS is capable to handle it? How to check this via JS (PHP, ...)?
I have found a lot of solutions (mostly for Mobile Safari) but cannot find anything cross-browser compatible.
From what I know, Chrome doesn't support this. You can try using a try/catch but it won't return anything. You can use your other references and put a specific call in their for Safari.
Lastly, I haven't tested it, but you can bind something to the window to see if it blurs.
$(window).blur(function() {
//code to see if it blurred on a setTimeout
}
Then record the date of creating it and see if it's within 1 second so when they come back you can destroy the timer if it's still there.
Just ideas though...
Related
I'm experimenting with the Speech Synthesis API. I have the following code:
var message = new SpeechSynthesisUtterance("Hello");
window.speechSynthesis.speak(message);
The code works perfectly fine, however it only works when the user has clicked or interacted with the current page on the browser. I get the following warning on the Chrome console when attempting to run the code without interacting with the page first:
speechSynthesis.speak() without user activation is no longer allowed since M71, around December 2018. See https://www.chromestatus.com/feature/5687444770914304 for more details
I want the code to run as soon as a user loads the page without them having to interact with the page first.
I looked into simulating a page click with javascript/jquery like this:
$('#randomElementOnPage').trigger('click');
And then running the speech code, but it doesn't seem to trick the browser.
Any solutions/advice is appreciated.
Thanks.
EDIT: Since there doesn't seem to be any solutions, are there any browser/audio settings in Chrome, etc I can change for myself to allow this to work for myself only. Someone suggested going to chrome://settings/content/sound and adding the site to the list of allowed sites for audio. However, this does not seem to work either.
If, as it's said in your EDIT, you want to use your code on your own computer (computers in some way controlled by you), you may instead use some automation tool (and it will press buttons/interact with the page on your behalf).
I don't know what is trending now. Puppeteer or Intern or something like that, probably, will be an overkill (and puppeteer is headless, as far as I know). A long time ago, I personally, used AutoIt.
I'm trying to write a chrome extension that auto-hides the bookmark bar and shows it when you hover over that area. I was able to do this through c++ by listening to the cursor location and using the ctrl-shift-b shortcut. Unfortunately this is not feasible using the extensions API so I'll have to find another solution.
Would it be possible to do this by changing the value of show_on_all_tabs to true in Preferences?
"bookmark_bar":{"show_apps_shortcut":false,"show_on_all_tabs":false}
If so, then how would I go about implementing that in my extension?
Thanks
There's no API available to Google Chrome extensions to change/hook/control the browser UI.
Other Chromium-based browsers may have something of the kind like Opera's sidebar API.
Changing any of the internal files like the Preferences is also not allowed. It's hard to change even externally as you'd need to change Secure Preferences too, properly updating its hashsum.
Sending Ctrl+Shift+B hotkey from inside an extension/webpage is fruitless as well as it will never escape the content sandbox, and won't reach the browser's internal event listener.
is there a client based javascript way to detect Eddystone-URL beacons directly from the Chrome browser in iOS?
I know Chrome has the widget for the today view wich works fine, but I need to detect new Eddystones without pulling down the notifcations window.
Say a user clicks on a link provided by the widget, gets redirected to the Chrome app, does stuff, walks around and gets in range from another beacon.
Right now he would have to pull down the tab again to receive the new URI. But I need some sort of notification from within the Browser.
I hope you get the idea.
Thanks in advance!
Cheers
p.
Unfortunately, this is not possible. Understand that Chrome for iOS is just a thin app around the standard native iOS UIWebView, so there is nothing you can do in JavaScript that you cannot do in Safari. And Apple does not implemented any JavaScript bindings to the CoreBluetooth APIs that would be needed to detect Eddystone-URL beacons. The bottleneck is more of an iOS restriction than a Chrome browser one.
Note that this is not true for the Chrome browser on other platforms, notably ChromeOS, which does provide such JavaScript APIs.
I'd like a local process on my machine to be able to trigger javascript in a specific tab in my local Google Chrome browser. The tab is not connecting to localhost, but to another known domain.
This may sound a bit weird, but what I'm actually trying to do is allow my in-browser music player to be controlled via global OS keyboard shortcuts, so I don't have to go to my tab in Chrome to pause or skip a track, for example.
I haven't been able to find any references to this type of behavior anywhere. Here are some solutions I've though of so far:
I tried looking at the Chrome Extensions APIs, and found the NPAPI Plugins which seem to allow javascript to trigger an external process, but I'm not sure if I could get it to work in the opposite way?
If directly triggering javascript is not possible, I may look into opening an HTML5 WebSocket to a tiny localhost webserver that can push control messages to the browser. I've read that WebSockets can function cross-domain in this way.
If both of the above don't work, I could always have a localhost process push to the remote server, which can forward the message back to my Chrome tab via WebSockets or another callback method. I really hope I can avoid this.
Are there features of Chrome extensions I'm overlooking that can be triggered externally? Or will a NPAPI plugin be able to do what I want? Or is there a better solution for this somehow? These all seem a little needlessly complex for such a simple task.
I would use the NPAPI Plugin becasue it is the best one too use for the thing your doing.
Good luck completing it.
Notice how Firebug can access the DOM of cross domain iframes and even allow you to modify them? I'm wondering if there is an firefox addon extension or a config setting that will allow a page on our intranet to do this.
Longer explanation:
I have a two "kiosks" in our reception area that the public can use. As we're running in kiosk mode (fullscreen, no chrome), I have created a small web application consisting of a menu and an IFRAME. The menu allows users to browse to approved sites and also perform actions like printing. It also gloms onto requests for popup windows and instead overlays them in a modal iframe rather than allowing the browser and OS chrome to be exposed - breaking the "kiosk" experience.
Obviously, this works perfectly on anything internal because it's all on the same domain. It gets trickier when browsing external sites because the XSS protection kicks in and you can't see the DOM inside the IFRAME.
I have also tried using a web-based proxy server on the same domain (PHProxy for example), which works okay, but there are horrible edge cases where it doesn't work - a big one is the CAPTCHA on our website forms. So that's pretty much not an option for me.
Basically I think the only solution that will work for me is to modify the browser in some way using a security setting or an addon. Any ideas?
Thanks guys very much for you time and consideration. It is VERY much appreciated.
--Iain
There is a way for unpriviledged JavaScript code (loaded from a web page) to request more privileges in Firefox. This is an old, non standard API that prompts the user for permission and if accepted allows the JavaScript to do things normal JavaScript cannot. One of these things is to bypass Same Origin Policy.
Sample code:
try {
// ask user for permission
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
} catch (e) {
// user refused permission
alert('Permission "UniversalBrowserRead" was denied.');
}
//Should now be capable of bypassing same origin policy if user accepted
Since the kiosk browser does not restart (I suppose) very often, the dialog just has to be accepted once. Not sure this is the most elegant solution but might work, at least for now (the API is old and might disappear).
Here is a link for more details: http://www.mozilla.org/projects/security/components/signed-scripts.html#privs-list
While looking for the exact privilege name I found this page about Security Policies in Firefox. This would be a much nicer solution. I have never used it, so I cannot give more info, but here is the link, might be a good place to start looking:
http://www.mozilla.org/projects/security/components/ConfigPolicy.html
Hope this helps!
I found an addon called CrossDomain. The addon hasn't yet been updated for newer versions of Firefox. In the end, I solved this whole problem by writing an HTA and using the internet explorer rendering engine - which made my IT manager happy :). Here is the link to CrossDomain in case this helps someone one day. Thank you everyone for your submissions.
https://addons.mozilla.org/en-US/firefox/addon/13004/
Why not use Greasemonkey, it will allow you to run your script on any page.