Chrome refuses to load some PDFs in the browser - asp.net-mvc

Our web application lets users upload forms in pdf format (which are then stored in a Windows Azure Blob) and also lets them view them afterwards. What we want to is embed the pdf in a lightbox sort of thing. This is working totally fine in firefox once something like Acrobat Reader is installed but Chrome does absolutely nothing with it.
Even before getting to the embed part, just opening it in a tab doesn't work in Chrome. Entering the url in firefox works fine and it will ask if you want to save or open in Acrobat Reader. Opening a new tab in chrome and trying go to the url does absolutely nothing. The page just stays a blank white, and the name of the tab remains as 'New Tab'.
I checked what was going on in the Network tab of the browser console, and all I see is a supposedly successful GET call (code 200) but the status of it is cancelled.

Related

how to use jquery mobile asp.net mvc 4 to download and display pdf memory stream data

I have a desktop/mobile web app that needs to display a pdf stream on the target device. I now have this working on the desktop using the jquery dialog. For mobile tho...my html View page has the following link:
View PDF
And that correctly takes me into the Controller Action:
public ActionResult PdfView(string id = "")
{
PayStubDataEntity ps = PayStubAccess.GetPayStubByID(new Guid(id), new Guid(Session["Session_Application_UserID"].ToString()));
WebHelper.SetHeadersForDownload(System.Web.HttpContext.Current.Response, "application/pdf", "PayStub.pdf", false);
MemoryStream pdfMemoryStream = SendPayStubToBrowserAsPdf(ps);
//WebHelper.SendFile(System.Web.HttpContext.Current.Response, "application/pdf", "PayStub.pdf", false, pdfMemoryStream);
return File(pdfMemoryStream, "application/pdf");
}
But nothing ever shows up on my iphone emulator (electric plum). No error messages. I am not sure where the output s/b going or how to view it? Any ideas would be most appreciated.
We have this same issue with android phones and there can be two issues going on. If the website uses ssl and the phone you are on does not accept it as a valid ssl, it will say downloading pdf in the manager, but it never completes a download.
The second issue is the file you are sending to the phone needs to be named in order to download properly to the phone.
Ex: return File(pdfMemoryStream, "application/pdf", fileDownloadName:"PayStub.pdf");
I would suggest using Google Chrome for phone emulation. When you change the settings, it will behave similarly to the phone and you can debug easily.
For example, when I set Google Chrome to the mobile phone user agent Android 4.0.2, it will download the pdf, instead of displaying within the web browser. When it does that, I know it is working locally. It also has iPhone emulation.

External web links won't open when click them - BB App development

I am developing my first blackberry app, I have strings.xml where I keep all HTML content I may need to display in some screens. I can successfully display the html content but nothing happen when you click the web links.
For example, I have the following in strings.xml
<![CDATA[Hazcheck systems]]>
When I load the above string into a screen, I see the link as expected, but, nothing happen when I click it.
I tried to remove CDATA tags, but, it didn't help. Any ideas?

firebug error - what does this mean?

I'm using the jquerymobile platform with one of my Drupal sites. It works flawlessly on my dev server, but on the live server, every time I click on a link it sticks a pound sign in and refuses to load the content of the page being linked. When I hit the browser's refresh button, the pound sign goes away, and the content does load.
Example:
Sponsors
should go to http://mysite.com/sponsors. What happens on my live site is http://mysite.com/#/sponsors. The page stalls there, but if I click reload, the # goes away and the content loads.
I have a user agent switcher in firefox, so I turned firebug on, and on the live site, I'm getting the following error every time I click a link:
"attempt to run compile-and-go script on a cleared scope"
This does not occur on the dev site. The live site is http://m.shoppersummit.com/. Any ideas why this would happen? As far as I can tell, I have the same version of jquery, jqueryui, and jquerymobile installed.
Edited to address redirect loop
I've been at work since 6:30 AM; my brain is fried. This is a drupal site, with a "real" theme and a mobile theme. The only way to view the mobile theme (which is where the error is occurring) in a desktop browser is to change your user agent string to a mobile one. There's a firefox addon that will do this. If you try to view the site with a standard desktop user agent string, you will get the redirect.
Have you tried including a target? e.g. target="_self"

How to add a link to start a file download in a Rails Facebook canvas app

In our Rails app that runs in Facebook canvas, we have a workflow where a logged in user can build a document and then download it.
When the file is ready we show a link to it. This is just a Rails action that renders using send_file in dev or head (with proper NGINX config) in production. This part works fine.
In order to have the file start downloading without opening a new browser tab, we had the link target an empty iframe.
This was working, but a while back, presumably due to a security change by Facebook, our link stopped working. The JavaScript errors show:
Refused to display document because display forbidden by X-Frame-Options.
Users can still open the link in a new tab and it will download the file and a quick fix is to make the link open a new browser tab, but that isn't as good of a user experience.
We tried changing the X-Frame-Options in the headers and/or using meta tags, but this is canvas (running in an iframe), so that just stopped those views from displaying.
I also tried this form solution, but it didn't do anything (I could have been doing it wrong).
Is there any way we can build a button or link that will start the file download without opening a new browser tab?
Do you need to set the target at all? With no target set would it not trigger a file download popup in the browser, but leave the current browser window/tab on the same content?

Links in remote JQueryMobile sites in a PhoneGap app open safari

I'm having quite a peculiar problem with PhoneGap and JQuery Mobile, using the latest versions of both frameworks as of this writing.
My phonegap app has some pages 'local' to the app, and other pages that are loaded directly from a remote site. Going between the local and remote pages is fine (there is no transition but that can't exactly be helped). However, once I'm on the remote pages, any link I click on the remote pages opens Safari with the page I requested. This is not desirable functionality, as I would like it all to be within the UIWebView, and none of my links are marked with anything special that would cause Safari to open.
It gets weirder. If I then switch from Safari back to the program, the remote page I requested appears in the UIWebView, however pressing the back button leads me not to the first remote page, but the first local page.
The phonegap app right now is quite bare, very close to the default except with JQM css + js loaded. This happens even if I create a simple test app that has one local JQM page, one remote JQM page and then a remote page that is linked to from a JQM remote page.
I'm stumped. What's going on here?
The default behavior for PhoneGap is to open external links in Safari unless they are added to the ExternalHosts property in PhoneGap.plist.
Try adding the external hosts and PhoneGap should behave correctly and load the external locations inside of the application.
(source: tumblr.com)
Here also is a post about using iFrames and ExternalHosts that could be of some help as well.

Resources