How to get arguments from LaunchApp NFC tag (when NavigationPage is not set in manifest)? WP8 - windows-phone-8

Answer from this question works fine if you have NavigationPage set for your default task in WMAppManifest.xml (it's set by default).
Unfortunately in my current application the start page depends on whether a user is logged in in the application. I determine this and then manually navigate to a required page in Application_Launching. Because I do navigation to the start page myself I don't have ms_nfp_launchargs argument in a QueryString.
Is there any other way to get arguments from LaunchApp NFC tag?

Ok, there are several solutions to this.
One is to use a temporary start page and renavigate to the real one from there.
Another option is to write some code word (like "startPage") in NavigationPage in manifest, and then to catch this code word in a custom UriMapper on a RootFrame and navigate to the required page.

Related

Is there a URL parameter that will make the URL open in a specifically named browser window

I have an email digest that is sent daily to users of my website and contains links to things on the site so that they can easily get right in and start interacting from their email. Trouble is, if they click more than one link, they're going to be opening more than one browser and the non-technical user might not catch that and end up having to close a bunch of tabs/browsers when they're done on the site. I want all the links in the email digest to be opened in the same window/tab.
I know that if you have an href you can set target=my_window and the links will open in that window. I'm wondering if there's a URL parameter that can be used instead of editing the a tag.
No. I don’t know of any browser (or other user agent) that associates any special behaviours with link query strings. The query string is for the server receiving the HTTP request to deal with.
As you say in your question, the target attribute is the method for controlling (or at least suggesting) what window the link should open in.
Can you use the window.open method?
Reference: window.open(url, name, features, replace);
It allows a browser window to be named, and thus reused when clicking on new links that are formatted to work with the window.open syntax.
Example: link
Status Update: Note you can search for many window.open(); Online Generators to help build the look of the opened window. It's important to test the desired look in all browsers, as the Address Bar in each browser is rendered differently.
The short answer is no. This behavior you are talking about is strictly client side, controlled by the browser. The application running on the web server is responsible for reacting to the query string.
Do you not have control over the template of the e-mails that are sent? It should be trivial to add the target to the appropriate anchors.
You can use PHP to catch custom URL parameters.
Say you have a link like:
www.yoursite.com/somepage.php?title=Some Page Title Here
The paramater string in the URL starts with ?something=somevalue and can be chained with the & symbol (e.g. ?something=somevalue&somethingelse=someothervalue) etc.
You can then ad this PHP to the top of your page:
<?php $title = $_GET['title']; ?>
Then for your title tag put the following:
<title><?php echo $title; ?></title>
You would add another variable with the value of the param for each param you want to pass in to the page. But for what you're trying to do, the above code will work.

Can you use HTML5 local storage to send form contents "later"?

Let's say someone is writing a reply to an online forum on their iPhone when they lose connection.
Is it possible to use HTML5 local storage to save their submission and post it when they get connection back?
If so, how do I tell if the phone has a connection or not?
Yes you can by implementing your custom logic into the app.
To see if a connection is available you could either use navigator.onLine flag (but it seems that is not completely reliable):
Does Safari and/or WebKit implement the equivalent of window.navigator.online?
http://html5demos.com/offline
or try to load content from the internet and see if it's possible or not:
Checking online status from an iPhone web app
Could you not use JavaScript to set a variable and make it a string with the content of whatever the user puts in the box? You could use getElementById or similar to get the content from the form.
Then, store it in a "cookie". If you don't know how to do this, here is a quick run down on javascript cookies from w3: http://www.w3schools.com/js/js_cookies.asp
Then on page load you could have it load the cookie and make the value of the form equal to the variable you declared earlier.
The best approach (in the light of navigator.onLine behaving inconsistently in different browsers) would be to save whatever the user is typing to localStorage every few seconds or every few keystrokes.
If the page is reloaded again, then you can make sure to first see if there is anything stored in the localStorage key, and if so, then load that into the text box and the user can continue from where he left off.
You can also take a look at the 'going offline with web storage' section of this article http://dev.opera.com/articles/view/taking-your-web-apps-offline-web-storage-appcache-websql/

Supplying arguments to an image-generation program

We have a web application that creates a web page. In one section of the page, a graph is diplayed. The graph is created by calling graphing program with an "img src=..." tag in the HTML body. The graphing program takes a number of arguments about the height, width, legends, etc., and the data to be graphed. The only way we have found so far to pass the arguments to the graphing program is to use the GET method. This works, but in some cases the size of the query string passed to the grapher is approaching the 2058 (or whatever) character limit for URLs in Internet Explorer. I've included an example of the tag below. If the length is too long, the query string is truncated and either the program bombs or even worse, displays a graph that is not correct (depending on where the truncation occurs).
The POST method with an auto submit does not work for our purposes, because we want the image inserted on the page where the grapher is invoked. We don't want the graph displayed on a separate web page, which is what the POST method does with the URL in the "action=" attribute.
Does anyone know a way around this problem, or do we just have to stick with the GET method and inform users to stay away from Internet Explorer when they're using our application?
Thanks!
One solution is to have the page put data into the session, then have the img generation script pull from that session information. For example page stores $_SESSION['tempdata12345'] and creates an img src="myimage.php?data=tempdata12345". Then myimage.php pulls from the session information.
One solution is to have the web application that generates the entire page to pre-emptively
call the actual graphing program with all the necessary parameters.
Perhaps store the generated image in a /tmp folder.
Then have the web application create the web page and send it to the browser with a "img src=..." tag that, instead of referring to the graphing program, refers to the pre-generated image.

GWT and autofill

I've noticed that browsers don't recognize my password field as a potential auto-complete target. I'm assuming this has something to do with the fact that the password field isn't in the original HTML - it's created by my GWT script after the page has loaded.
Is there a way to tell a browser, "hey, here's this form, treat it like usual?" How can I let browsers hook into my app for autofill?
There are some workarounds to get the browser to auto-complete your login like the one described here.
After struggling some time with it I strongly suggest you simply wrap an existing form of your host page (do not generate the inputs with GWT), do a form.submit() on it and have a servlet listen to the request.
I believe that password fields ( tags with type="password") are not auto-filled for fairly obvious security reasons. It doesn't matter that the field is added after page load by your GWT script.
Try mimicking the field in regular HTML and compare that to how your GWT app creates the DOM structure. Perhaps your GWT app is putting the page together differently?

sIFR 3 issue (IE) with BlockUI and UpdatePanel

I am experience an issue using sIFR 3, jQuery BlockUI and an UpdatePanel where the page refreshes and the SIFR font disappears.
In the Javascript file I use to handle the blocking and unblocking of the UI, I detect the partial postback and unblock the UI:
prm.add_endRequest(function() {
$.unblockUI(); });
If I re-run sIFR.replace() in this code block the font sIFR font is rendered, but # characters are replacing my page title (in the top of the browser window/tab). This seems to only happen in IE (go figure.) Each time I refresh the page using the LinkButton an extra # character is added, so my page title ends up looking like "#########". Any idea why this is happening?
Is there a specific sIFR.update() function I should be running instead? If I execute sIFR.redraw() or sIFR() I get javascript run time errors.
This is caused by a bug in IE:
This is a very peculiar bug in IE where for each Flash movie in the page the fragment identifier part of the URI (#foo) is repeated in the document title. It has been reported by Macromedia that this bug can be fixed by updating the VBScript engine the browser uses. However, for those users who still have the wrong engine sIFR contains a workaround.
http://wiki.novemberborn.net/sifr/Fragment+Identifier+Bug
sIFR 3 has a workaround but it doesn't kick in unless the page is loaded with a fragment identifier (window.location.hash != ""). In your case, I assume the page is loaded without the identifier, then you add one, and then you re-run replacements, reinvoking the bug.
You can patch r436 by opening (the compressed version of) sifr.js and replacing this.fix=c.ua.ieWin&&window.location.hash!="" by this.fix=c.ua.ieWin.