Making all Links in a Web View open in the Default Browser - objective-c

I have a web view that displays a web page but I want all links on that page to open in the default browser. How would I do this?

Implement the WebPolicyDelegate so that any attempts to navigate are cancelled, and the URL opened in the default browser.

Related

Safari App Extension content script not loaded on Safari error page?

When running a Safari App Extension, if Safari shows "Failed to open page", your content script isn't loaded. In this sort of scenario, it might be nice to redirect the user to a new url or suggestions page such as "did you mean...".
Is it possible to get a Safari App Extension's content script to load when a Safari error page is showing up?
No, it does not appear to be possible.
Based on Apple's Safari App Extensions "About Permissions for Scripts and Style Sheets" documentation, I'm deducing that script injection only works on web content from http:// or https:// schemes, while error pages are loaded from local files.
A URL pattern takes the form Scheme://Domain/Path.
(...)
Scheme can be http or https. (...)
The asterisk character can be used anywhere in the domain or path, but not in the scheme.
For reference, here's the path of a Safari 13 error page template.
file:///Applications/Safari.app/Contents/Resources/en.lproj/StandardErrorPage.html

How do I prevent a url from being displayed outside Messenger webview? e.g. directly in a browser

I'm working on an experience that should happen exclusively inside Messenger. How do I prevent an url from being displayed outside the webview. For example: user taps on 'Copy Link' and opens it in a browser.
Also, any way to disable the share button in a Messenger webview altogether?
There is no way to prevent the user from opening the link in another browser. Best you could do is detect the user agent on the page, then display an error that redirects to the bot and then resend a message with the URL button.
You can also set webview_share_button to false on the url button:
https://developers.facebook.com/docs/messenger-platform/reference/buttons/url

Web browser control shows Navigation to the webpage was canceled

I have a web browser control in my MFC application, when I navigate to a https site, it shows "Navigation to the webpage was canceled", but it always OK with IE browser.
Added
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\myapp.exe"
and
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION\myapp.vshost.exe"
(value is 11000) in registry,
but the web browser control only work sometimes, and in most time, it cannot work, and shows "Navigation to the webpage was canceled". Refresh page will show "There is a problem with this website’s security certificate".
I built the project in debug mode (32-bit).
Any one knows how to fix this?
Thanks!

Create an Eclipse plugin that responds to links in the internal web browser

Is there any way to hook into the eclipse web browser? I'm opening a link using IWorkbenchBrowserSupport.createBrowser, but after the page is launched I want to be able to take some action based on links clicked within the browser. Can you create a listener for browser events?
No. IWorkbenchBrowserSupport.createBrowser returns an IWebBrowser. The IWebBrowser interface only defines 3 methods.
close()
getId()
openURL(URL url)
I believe that openURL is used to navigate to another web page using the URL address text box.
You could write your own web browser that would allow you to create listeners for browser events.

Facebook Canvas application anchor tags are not working properly?

I'm developing a Facebook canvas application in rails 3.1 and using the latest Facebook graph API.
In anchor tags, when I give the href='/something' it's working nice when I navigate in same browser tab. The link is pointing to my host URL like host_url/something host_url contains HTTP as well , but when I open this anchor in a new tab using right click of mouse and chose to open in new tab it open the URL http://host_url/something and not in Facebook canvas.
I also change the anchor href with http://apps.facebook.com/my-app-name/something when I click this link nothing is displayed and request is no coming to my host. When I open this URL in new browser tab it works fine.
Can anybody tell me what I am doing wrong?
You're not doing anything wrong - if you're using relative links that's what will happen, because the app content is loaded in an iframe
Change your links to be absolute URLs including the apps.facebook.com/[namespace] prefix if you want them to always link to the canvas app when opened in a new window