Passbook adding href - passbook

I'd like to create a Passbook card with a URL on the back page in one of the "Back fields". Does anyone know if it's possible to use a href entry so that I don't expose the actual URL?
For example, in the JSON record, instead of:
"value" : "Click here, http://google.com.au"
make it:
"value" : "Click here, <a href='http://google.com.au'>HERE</a>"

No you cannot, any html markup field will be parsed.
Urls are parsed automatically and must be in plain text.

#MacTeo is correct, URLs (emails, telephone numbers and addresses) will automatically become clickable, but the any HTML markup will be not be processed and you'll end up with the raw HTML visible on the back of the pass.
The best you can do right now is to get hold of a short domain and install a redirect script.
Then you can use something short but enticing such as http://wt.is/latest_offer that redirects to wherever you want.

From iOS7 on you can use the attributed_value property for this. (docs):
"attributedValue": "<a href='http://example.com/customers/123'>Edit my profile</a>"

Related

Google+ : Multiple +1 on same page, different content

I've tried to find an answer to this (both in the dev docs and here), but with no luck.
The "+1 button" works fine on normal pages (where there's just the single +1). But I have a page with multiple entities (to use the terms of Drupal: A View displaying multiple nodes) where I'd like to add "share buttons". So far I've added Twitter and Facebook.
Twitter is the simplest as it just takes the string you give it..
Facebook takes an url, but you can specify your own url.
When I try to specify my own url for +1 I get this Error:
Unsafe JavaScript attempt to access frame with URL http://one80.seasites.se/whats-up from frame with URL https://plusone.google.com/_/+1/hover?hl=sv&url=http%3A%2F%2Fone80.seasites.se%2Fwhats-up%2Fl%25C3%25B6rdag&t=1342724634133&source=widget&isSet=false&referer=http%3A%2F%2Fone80.seasites.se%2Fwhats-up&jsh=m%3B%2F_%2Fapps-static%2F_%2Fjs%2Fgapi%2F__features__%2Frt%3Dj%2Fver%3Dr4LFRxx-_oY.sv.%2Fsv%3D1%2Fam%3D!ZCfx2q5v6YmYvWjcTQ%2Fd%3D1%2Frs%3DAItRSTNI50TT3SY8R9klRLc_1sBJ5_Rp3g#id=I3_1342724634541&parent=http%3A%2F%2Fone80.seasites.se&rpctoken=619983104&_methods=mouseEvent%2CtrackingEvent%2ConVisibilityChanged%2C_onopen%2C_ready%2C_onclose%2CcloseOrHideThisBubble%2C_close%2C_open%2C_resizeMe%2C_renderstart. Domains, protocols and ports must match.
rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:173
ec.a.v rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:173
xh rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:203
q.get rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:211
ec.w rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:173
Rh rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:208
q.w rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:220
Rb rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:30
Xg rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:187
(anonymous function) rs=AItRSTOQ10u7fGwgD-LqzsOa-fsgdlhDCg:226
To explain why I want to use separate URL:
every node is something like an event, every node has it's own url (which contains an image and text/info). So when you click Like (for FB) it gets the title, info & image and includes it in the post (So it says "What's up - Gathering", instead of a generic "What's up" and no/the same image).
I'd like to accomplish the same with G+.
Is there a way to accomplish this for G+?? Have I missed something??
I guess one way to do this is by using an iframe for each of the nodes and pull in a special version of the "node page" with just the g+-button. But that's a pretty nasty hack (and not that fun to set up).
Any ideas are welcome!
The error you're seeing is actually due to an issue in Chrome. The +1 button should automatically recover.
You can explicitly specify target pages by using the href attribute. Your markup will look like this in practice:
<g:plusone href="http://example.com/targeturl"></g:plusone>
Or like this with HTML5 syntax:
<div class="g-plusone" data-href="http://example.com/targeturl"></div>
If these don't work, can you share a link to a page where you're seeing it not work? I can take a look :)

parsing html data iphone xpath

have this webpage http://www.westminster.ac.uk/schools/computing/undergraduate . I'm using hpple to retrieve data (just started learning about it). I want to specifically retrieve the href from he main page, how can i do this?
I have this line - "NSArray *elements = [xpathParser search:#"//a"];" is able to retrieve all of the href links within the page however how can i retrieve just the ones in the main content? e.g. "BSc Honors Busniess Information Systems"? whats the syntax for it?
It looks like all of the "main content" stuff is found underneath elements with id attributes like "content_div_XXXX" where XXXX is some randomly generated sequence. You might be able to get at what you want using an XPath that looks something like:
//div[starts-with(#id,'content_div')]//a
You should be able to get something like this working, although you'd have to try it out and perhaps tweak it a bit to make it work precisely as you want. Refer to W3Schools XPath page for a good set of XPath tutorials

Dumping browser document content using Zombie.js

Using browser.visit, I am fetching the page of a browser as shown in the documentation. According to the browser API, browser.document returns the main window's document. However, I am not sure how to dump (display) the contents of the document. Is there a method like browser.document.toString() or browser.document.text() to be able to print the contents of the document in the console.
Thanks,
Sony
What you want is probably:
browser.document.innerHTML
There is a browser.text(selector, context?).
Selector is a CSS selector evaluated against the document body.
Context is a optional second argument, the CSS selector is evaluated against the element given as the context.
You can say something like browser.text('body') to get the text in the body.
I got here while looking for answer for the same question.
I may be late for the party, but try using
Browser.visit(url, function(error, browser){
fs.appendFileSync('index.html', browser.html());
})
Remember to put error checking here and do better handling, but should give you basic HTML document.
If it's not necessarily HTML (like you find yourself pulling XML or JSON through Zombie due to complicated, valid reasons...), you can access it like this:
browser.document._childNodes[0]._nodeValue

Create hyperlink to some text in NSTextView

I can create a hyperlink to some url in an NSTextView using the "Link Panel". Or I can add a link manually using the NSLinkAttributeName attribute of NSAttributedString.
I don't want to make a hyperlink to some external url though, I want to be able to create a hyperlink to some text within the NSTextView. Do you know how in Pages you can set some text as a Bookmark, and then you can make a hyperlink to that bookmark? Any ideas or examples of how to go about that?
I haven't done this in a while so take this with a grain of salt but it goes something like:
You need to define a protocol for you app to handle URLs. It will look something like "myApplicationName://aPath"
In the apps Info.plistfile add the protocol under CFBundleURLTypes key.
Write code for the app to respond to openURL from NSWorkspace. This means the app will have to understand how to convert a URL style path to a specific location in one of its documents.
I think the best method for handling the URL path is to assign a UUID to each document and then a numeric scheme to the paragraph and sentences. The URL ends up looking like: myApplicationName://UUID/paragraphNumber/sentenceNumber/wordNumber. Alternatively you can insert hidden text to define an anchor and just search for that anchor.

HTML encoded links and anchors

I have a use case where I am setting the page focus to a particular element (having an anchor before it). When a user is not signed in, there is a redirect to the login page and after signing in, the user is redirected to the page in question, with the URL encoded.
I see that a URL of the form link#target works as expected (focusing on the element) while the url encoded link link%23target doesn't. Is this expected behavior?
Edit: If this is the expected behavior, is there a work around to focus on the target? As in, a way around url encode?
Edit adding more info:
Assuming that there is a code
page1.html
... html before the anchor ...
<a name="test">Some code</a>
... html after the anchor ...
I am accessing the page as page1.html%23test. This doesn't work the same way as page1.html#test. Is there a jQuery method to implement this? Would location.hash contain test even after it has been url encoded? I have no control on changing the url encoding.
Edit:
As I knew which named anchor I wanted to go to after page is redirected, I did a
window.location.hash = namedAnchor
to solve the issue. This JS line is output only if a customer is successfully signed in. Solved my issue, though not the generic answer I was looking for. I was looking for a way to avoid escaping of # in url encode.
Yes. Encoding the # as %23 effectively says "I just mean a plain old "#" character, not a URL fragment". The same is true of other reserved characters: escaping them stops them from having special meaning in the URL.
In your case you do want to encode the URL when passing it to your login page as a parameter, but your login page should decode the URL before performing the redirect.
You can both parse this string with PHP or other script language, or with JavaScript using the encodeURIComponent. I wrote an article for that, you can check on http://www.stoimen.com/blog/2009/05/25/javascript-encode-cyrillic-symbols-with-encodeuricomponent/
Hope that can help you. However despite the default behavior you must check with either method.