how to handle "#!" links in iUI

17 views
Skip to first unread message

DaSaver

unread,
Mar 20, 2014, 7:33:55 AM3/20/14
to iphone...@googlegroups.com
making mobile website using iUI, have trouble with links like <a href="#!/country=turciya">some text</a>

those links generated by third-party (and hosted on third party host) js widgets, placed on my webpage.

clicks/taps on that links not works and after click/tap, all other navigation on webpage stops working.

any ideas how to solve this problem?

Sean Gilligan

unread,
Mar 20, 2014, 5:14:28 PM3/20/14
to iphone...@googlegroups.com
iUI is a framework and largely assumes that it has control of the entire
page and the format of links within the page. It is not really designed
to work with 3rd-party widgets, especially widgets that are "routing"
based upon browser location.

However, it can be made to work with third-party widgets if you are
careful and willing to look at the iUI source code carefully.

The first thing that I would try is adding a Regular Expression to the
iui.nativeUrlPatterns array.

Use something like the following code immediately after loading iui.js:

iui.nativeUrlPatterns.push(new RegExp("^itms:"));

You'll need to replace "^itms:" with a regular expression that matches
the links you want iUI to ignore, something like:

"^\#\!"

Assuming I got the escapes correct.

This should stop iUI from capturing the clicks on those links and should
stop them from breaking navigation. You may have other issues after
making that change, but it's the first thing I would try.

-- Sean
Reply all
Reply to author
Forward
0 new messages