views:

289

answers:

3

Hi,

Using the JQTouch library, usely links like the following ... should open the new page in the SAME window. That works fine when I go to the site using Safari BUT when I launch the site from the home saved icon, it opens a fullscreen site and on the first link it opens a NEW Safari window. How can I make it stay in the same original fullscreen window?

A: 

One solution I found here is to change the way you write your links for a mobile app. Rather than a href='link.url' you'd write a href="javascript.window.location.href='link.url'"

Dislaimer: I haven't personally tried this yet, so I can't guarantee it will work. But logically, it does make sense.

EAMann
I tried with `href="#" onclick="window.location.href='link.url'"`, it worked BUT I had wierd JQTouch behaviour (my current user was getting disconnected, sometime the link didn't do nothing, ...) ... well I backed off for the moment.
+1  A: 

You have to set the target to _webapp. E.g:

<li class="arrow"><a href="some_page.html" target="_webapp">Some Page</a></li>

and then it will load on the same page.

Kris Erickson
Looking for `window.name`, I didn't see anything like '_webapp' so it didn't work. But I liked the idea and I tried adding `window.name = '_webapp'` at the beginning of my page. It doesn't work when using fullscreen mode: it still opens a new Safari page.
It has nothing to do with window.name, it is part of the underlying jqtouch code, when an anchor is clicked, jqtouch runs some code in the background which overrides the default behavior, adding _webapp is part of this.
Kris Erickson
+1  A: 

You need to look into manifest files.

The manifest file declares what files (html, javascript, css, jpgs etc.) that the iPhone should cache in order to make a webapp work offline. A part of the manifest file is used to declare which URLs are OK to use when in full screen (webapp) mode.

Specifically look at NETWORK in manifest files.

Example:

NETWORK:
*

This should allow access to any URL you like, and stay in webapp mode.

Alternatively use target="_self" - I haven't seen target="_webapp" anywhere.

/Mogens

Mogens Beltoft