Can I use an IFrame to navigate to an external page in a Windows 8 Metro application? - windows-8

When I currently try I get the following error, even after adding google as a content URI
APPHOST9613: The App Host was unable to navigate to http://www.google.com/ due to the following error: FORBIDFRAMING.

Response from MSFT:
http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/a1cba639-3251-4df8-abd3-b6f6a95ba4ae

You can use Iframe,but you won't get full controll of their JS files,you may have to face some breaking point in such sites, and some sites like google blocking this facility.
Try this,
1. Make your default browser as IE10 which will provide you an App look for IE.
2. trigger an event
function openYourLink() {
var url = new Windows.Foundation.Uri("http://www.google.com")
Windows.System.Launcher.launchUriAsync(url);
}

You can use iframe to navigate to other pages.
<iframe src="http://www.apple.com" />
will do the trick.
However, not every website allows you to put their page in an iframe or they maybe using the top window layer so that their page doesn't support running in an iframe.
In addition, if you are running your code Visual Studio 11 Express, it may throw javascript exceptions in the web page in the iframe. You can "continue" it. This exception will not be visible when you are running a deployed version of your application (running from start menu).

On further investigation the answer seem to be that yes you can for most sites, but some sites (such as google) seem to fail when embedding with an iframe.

Related

Force Blazor WebAssembly app to open an Edge window from IE11

I am fiddling with Blazor WebAssembly to make a PoC and try to convince some people to start using it to develop Intranet web apps. However, our standard browser for Intranet content is IE11. Since Blazor WebAssembly is not supported in IE11, it may as well be the best thing in the world but I believe we will not get off to a good start by saying "This does not run in IE11, so people must use Edge for this particular app".
In order to minimize this issue, I was wondering how to make some URLs open on Edge. I know this is possible because if I paste a Teams meeting URL onto IE11, the page is not rendered and a new Edge window opens up automatically instead. Does anyone have any idea how to accomplish this?
From your description, it seems that you want to open an Edge window from IE 11 browser and view the website, right?
In this scenario, I think you could try to use the URL Scheme: microsoft-edge:{website url}. Then, it could open the Edge browser from IE 11 browser.
Sample code as below:
link
[Note] If you are viewing the website on IOS , the URL scheme should like this: microsoft-edge-http:// or microsoft-edge-https://.

Getting error using Firebase popup authentication in Word add-in

I was already using Firebase for authentication for other (related) projects and would like to stick with it.
Using Firebase with a Word add-in seems challenging. On Windows you're stuck with IE11 and on Mac (crucial for me) the browser used to load a taskpane is webkit, not the default browser.
I can get authentication on Windows to work just fine if I use signInWithRedirect (Google and Facebook).
But this won't work on Mac. Using signInWithRedirect opens a new tab in the default browser, which doesn't share cookies/data with the webkit browser the add-in actually uses.
When I switch to signInWithPopup, I get:
There is no application set to open the URL about:invalid%23zClosurez.
On Windows I get a popup IE11 window, for a split second, and it contains about:invalid%23zClosurez for a URL.
I have appdomains called out in my add-in XML manifest:
<AppDomains>
<AppDomain>https://writeitwithme-a114a.firebaseapp.com</AppDomain>
<AppDomain>https://www.firebaseapp.com</AppDomain>
<AppDomain>https://www.googleapis.com</AppDomain>
<AppDomain>https://www.facebook.com</AppDomain>
</AppDomains>
Any help appreciated. Worst case I drop to using manual registration, via Firebase, for Mac, but seems unfortunate to have to give up.
Just documenting for anyone finding this later.
I couldn't figure out how to use Firebase social login when creating an add-in for Mac. Every authentication window opened in the default browser, not the webkit engine used by Word on Mac. Sticking with manual login worked.
IE11 is always finicky when using localhost. I test elsewhere, then push files live and then try IE11 and social + manual login (via popup) works just fine.
I found the following resources from Microsoft docs that made this easier for me:
https://learn.microsoft.com/en-us/office/dev/add-ins/develop/dialog-api-in-office-add-ins
Basically you need to make a call to open up a dialogue box:
Office
.context
.UI
.displayDialogAsync(
'https://myDomain/myDialog.html',
{height: 30, width: 20, displayInIframe: true}
);
Then you can make your own page that does a login flow and passes a message (likely a credential of some kind) back to your plugin via the messageParent method:
Office.context.ui.messageParent(googleProfile);
From there you can do the following to sign in with the credential provided in your add-in:
firebase.auth().signInWithCredential(credential)
Also, be very careful with how you construct the URL of the dialogue box. I lost hours not knowing that the _host_Info param from the origin URL would mess stuff up (I was constructing my new URL from the origin URL). Figured it out in this github issue: https://github.com/OfficeDev/office-js/issues/378

InternetExplorerDriver not opening site, but user can open it

I'm working in a highly secured environment. I can only use IE11 by company's policy. I'm trying to implement test automation on my project.
I'm using Selenium and IEDriver.
Currently I'm trying to implement basic scenario by just opening application page.
When I'm trying to do it via IEDriver, the page is not getting opened and the message "This page cannot be displayed" is shown.
But when I open the page manually by just typing in the url to the address bar everything works fine.
I guess it has something to do with the cookies that are coming with the request I'm making manually. Seems like those cookies contain some signature.
Can someone advise me how can I track the problem to resolve it?
Thanks.
Be sure top follow the required configuration section on this site: https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver
I had some issues with IE acting the same way until following this setup.
So the issue was fixed by setting proxy.
Seems like there was a change in security rules recently.

Issue with rending an MVC 4 website inside an iFrame

We have an existing live MVC 4 website that works exactly as it supposed to, running in an Azure Web Role.
A third party want to embed our site in an iFrame on their site (a small part of it anyway, one form really)
I'm no fan of iFrames but this is what they want to do and our business are happy for them to do it.
Except it doesn't seem to work at all.
So I tested it myself with an html page just running on my machine.=, with just an iFrame and a link to the site.
The default page loads fine. It is a forms login screen, when I submit a login, the site crashes into the exception handing and it doesn't provide much useful information.
I then tried pointing the iFrame at the site running in my dev environment. Submitting the login and debugging into the action, the code flows through correctly, no error and tries to return the correct view, but iframe refreshes to the login screen again.
What could be causing this? What am I missing?

Facebook Connect button not showing up in Safari/Chrome

My implementation of Facebook Connect (just a simple login button, fb:login-button) works perfectly on Firefox and IE.
But the same button is not showing up in Safari/Chrome (Webkit).
Here's what's ironic. In my debugging effort, I saved the page (that contains fb:login-button) up as a static page and then load it in Safari. And the button shows up, everything works!
The exact same page (with the exact same HTML source) rendered by my PHP has no way for bringing up the button.
I'm trying hard to support Webkit here but I'm close to giving up. Can anybody help?
I found one more way this can occur (the blame-myself-for-being-stupid way); it's probably not common, but in the event is saves anyone else the hassle, here it is:
This symptom can also be caused by various security tools blocking facebook resources.
In my case, I'd installed Facebook Disconnect ages ago in Chrome as a plugin and forgotten all about it being installed. I also had a second installation of Chrome that was seemingly identical (but did not have Facebook Disconnect). The first would properly load the fb:login-button, and the other would not; took me ages before I looked at the plugins, because Facebook Disconnect didn't have an icon and so its presence was pretty easy for me to miss.
Here's what you'll see if some sort of security plugin is preventing facebook resources from loading. Just look at the html that renders in the browser using developer tools.
In a normal chrome session you'll end up with something like this:
<fb:login-button><a class="fb_button fb_button_medium"><span class="fb_button_text">Your text here</span></a></fb:login-button>
But in the version with facebook's resources disabled you'll end up with this:
<fb:login-button>Your text here</fb:login-button>
Like I said, pretty obvious in retrospect.
Had the same problem but it was not related to anything like a plugin or malformed content. It seems if you enable country filtering on your facebook page it has an issue with the like button, this should be fairly obvious. Facebook gets your location from your profile and not your IP address.
Make sure to disable country locking if you plan on using the social plugins.
This can be due to having ClickToFlash installed. Either disable it, or check "Automatically load invisible Flash views" in the ClickToFlash settings.
What we found out is that Safari (and maybe some older versions of Chrome or other WebKIT browsers) have a problem with Facebook's code using the innerHTML JS function if your page arrives with an XHTML response header (application/xhtml+xml).
Using text/html solves the issue.
In case of JSF2, which we use, the implementing the fix was as simple as wrapping the FB button like this:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml"
xmlns:f="http://java.sun.com/jsf/core">
...
<f:view contentType="text/html">
<fb:login-button>Login using Facebook</fb:login-button>
</f:view>
Facebook bug report here:
http://bugs.developers.facebook.net/show_bug.cgi?id=5545
I had this problem with the Facebook button not showing at all and it took me forever to figure out what it was. Luckily after days of hair pulling I will now share the answer with everyone. In my situation I simply didn't have xfbml enabled. In my FB.init I had it set to false:
FB.init({
appId : 'app_id', // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : false, // parse XFBML
oauth : true // enable OAuth 2.0
});
I changed this to "true" (xfbml) and the login buttons works great now! :P Good luck!
This happened when I had the wrong domain in callback_url in config/facebooker.yml. Apparently it uses that to load the js files.
I had the same problem but I resolved it by making sure the URL in my app settings was exactly the same as the one for my site (i.e. it didn't work when I accessed my site without the www.).
I have tried every suggested solution here and it didn't work for me. But now I finally found the solution.
Facebook requires now a secured (https) for Canvas (Secure Canvas URL). The unsecured one will be deprecated soon.
Here is the main difference, Chrome doesn't like https connections with invalid certifications. On a localhost, it is very likely you have stunnel installed to allow https connection for the localhost. Firefox is ok with the self created SSL certificate and allows you to add an exception when trying to access that site. Chrome doesn't allow it out of the box.
When I load my app in Chrome the page is blank and I dont see any login button.
Click F12 and click the Netwrok tab in Chrome:
You see that the post request to your localhost is cancelled. DOUBLE Click on it.
Now you would see that chrome is blocking the localhost because of the certificate:
click on proceed anyway.
Now to back to your other tab and reload the page:
Chrome works now like Firefox and shows the login button.