Schema URIs in Windows Store Apps vs Chrome - c#

I'm developing an app for Windows 8.1 called myTrip and I'm implementing my custom scheme URI for the app. I want this URI : mytrip:place:/m/0942y1 to open my app and navigate to a place with that ID. I have the logic done, it works fine if I run it from Windows + r. I want to distribute this uris in a facebook page, and when a user clicks on it, the app will open and the place shown. It's more or less the same thing that the windows store web page of your app does:
http://apps.microsoft.com/windows/en-us/app/mytrip/ae689d16-f349-4596-8bc7-e0eeab87ec24
This works in IE and Chrome, the schema that opens the store app is this:
ms-windows-store:PDP?PFN=19185FernandoUrkijoCerced.MyTrip_q1p7rzex4ekjr
If you copy and paste it on Chrome, and you have Windows 8, the app store will open. But, if I try with my custom URI:
myTrip:place:/m/0942y1
It only works on IE, not on Chrome. Why the Windows app store schema URI works with Chrome and not with my schema? Any ideas or hacks to bypass this problem?
Thanks you.

Chrome does not automatically recognize custom protocol handlers. Firefox will recognize when you are trying to use a protocol handler and offer to create a protocol handler definition for you. IE recognizes them.
On top of this, Chrome by default excludes protocol handlers it doesn't know.
In order to add your app's handler to Chrome:
With Chrome Closed
Navigate to "C:\Users\%Username%\AppData\Local\Google\Chrome\User Data"
Edit the file "Local State" with Notepad (or Notepad++)
Go down to the section marked "protocol_handler". You can also search for "ms-windows-store"
Add a line in "excluded schemes": "myTrip": false,
Save the file
Start Chrome
You should be able to use your protocol inside Chrome now.

Related

Is there any way to fully control browser from application?

I was trying to make a pc application that helps people more conveniently when they are using a browser(e.g Chrome, Firefox, Edge ...)
For example, the application shows the default browser and let user can choose another browser as default if they want to, and the app shows all windows that are currently opened; Overmore, when the user clicks a specific window then app will focus the window.
user can select default browser
user can see all windows categorized by browser type
So, my initial planning was using Election js; however, I've found that there is no way to control a browser from the Electron application since Node js cannot access the users' system(this thinking could be wrong since I have poor English😥)
After some research, I'm guessing C# can do that by using windows api. I've saw this post that saying by using DDE, we can get tabs urls.
But I'm wondering if C# can fully control a browser; for instance, create a new window, notice if music or video is playing in the tab, request to browser for getting favorites list.
If it cannot, how about requesting api to the browser from pc application?
You cannot fully control a browser. Internet Explorer was the only browser that had a documented and supported API to control, inspect and automate. Internet Explorer is dead so this is a dead end. The basic DDE control interface is also outdated.
Accessing favorites and the content of open tabs is limited because evil people would use such APIs to inject and spy. If you want to access the favorites you will have to write custom code for each browser.
Using the accessibility and UI automation APIs is the only reliable and supported way of interacting with modern browsers. SetWinEventHook can be used to detect window creation and primitive state changes. MSAA/UI Automation needs to be used to get more information from each browser window.
The thumbnail API and/or magnifier API can be used to get the preview image.
To open a new tab, execute a new process with the URL on the command line. Some per-browser customization might be required (-new-tab parameter etc).
Use IApplicationAssociationRegistration::QueryCurrentDefault to detect the default browser.

Does launching app for an http link on Windows 10 require server-side changes?

I followed the guide HERE to link my app to an https URI. It works perfectly fine during testing, for both Debug and Release versions: when I click a hyperlink for the website, the app is launched instead of Edge. The OnActivated event is triggered and the app goes to the desired page, all well and good.
Keep in mind, I'm not using the LaunchUriAsync technique that opens the link only if the app is in foreground.
But when I uploaded the app to the store and downloaded it on the same device I was testing on, the app is not launched. Instead, the webpage opens in Edge. Why is this happening? Is it really mandatory to do some server-side changes to make this work? I'm afraid I don't have access to that, as my app is a third party alternative.
Can someone informed on this topic tell me how I can go about this?
Also, the app does show up under the "Apps for websites" section in Settings -> System when installed through the Store.
The document has a mistake before 8/26, The Json file name should be "windows-app-web-link", not "microsoft-app-uri-handlers". If you have referenced the previous document to lead to not work, please update.
If you still have issues after updated, please test the configuration of your app and website by running the App host registration verifier tool (Details please see the 'Test it out: Local validation tool' section of https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/web-to-app-linking)
Because according to the document,
all side loaded apps with AppUriHandlers will have validated links for the host on install. You do not need to have a JSON file uploaded to test the feature. It seems may be something wrong with the JSON file so you can have a test.

How to allow blocked content in an embedded Webbrowser in c#?

I'm developing a c# application that embeds the Webbrowser control. I create the Website dynamically and use NavigateToString() to display it. I'm on Windows 8 with IE10.
Now my Problem is: Javascript won't execute. For example I added a link that calls alert and another one that calls reset() on a form. Both do nothing. I believe it has to be some security issue because when I say the generated page and open the file manually in IE10 and click one of those links, I get a popup at the bottom that says "Internet Explorer restricted this Webpage from running scripts or ActiveX controls." and a "Allow blocked Content"-button. If I just Close the popup, nothing happens, if I click "Allow blocked Content" the JavaScript works fine.
How can I enable JavaScript in the embedded Webbrowser?
How are you accessing this local website? is it localhost? you need to make the url security friendly so it doesn't get blocked, give it a url http:// localhost:someport instead and it should work

Redirecting to device settings

Say I have a mobile optimized website which runs with a lot of javascript on it to create awesome effects, and a user enters the website via a mobile browser which doesn't have javascript activated.
Is it then possible to (through a button click) redirect that user to his/hers browser settings?
You need to have JavaScript activated in order to browse this site properly.
Click here to change your settings
In principle, you can create an intent: URL that references an ACTION_SETTINGS Intent, though I have not tried this. Off the top of my head, the simplest way to construct that URL is to generate a scrap Android project and call:
Log.d("Something", new Intent(android.provider.Settings.ACTION_SETTINGS).toUri(Intent.URI_INTENT_SCHEME));
then check LogCat for the URL that you would put in the Web site. Of course, this URL will only work on Android devices.
I only know Windows Mobile (and there, only up to v6.1), but I would guess your clients would have to have some app of yours prior installed to access features of the device itself.
If websites could access a device's features, it would be viewed as a virus.

Open app e.g. Word then open file via FireFox (for WebDav integration)

I'm writing a custom WebDav integration for our website and in IE I can use new ActiveXObject to open e.g. Word from javascript then open a file. It's got to be like this to enable the applications WebDav integration, I can't just use a link.
We support Firefox as a browser however and new ActiveXObject doesn't work. I've toyed with writing a Silverlight 4 app which apparently can open Word on the user's desktop or even asking the user to download some sort of Console app that launches Word/Excel/etc. I don't want to do this though and I keep thinking someone must have had this issue before.
So.. is there a way to open Word from Firefox FIRST, THEN open a url from Word.
Cheers,
Adam.
UPDATE: Silverlight 4 no longer an option, don't want to use OOB
Not in plain HTML. But a firefox extension should allow this.

Categories

Resources