Charlie Calvert on Elvenware

Writing Code and Prose on Computers

Elvenware

Linking from JQuery Mobile

I like JQuery Mobile, but I have had problems with losing control over my CSS when I link from a JQuery Mobile page to a regular page. When I reach the regular page, my CSS does not render correctly and JavaScript is sometimes disabled.

Here is how I fixed the problem. This is not an official solution, but it worked for me. I created a custom JavaScript method that gets called on an onclick rather than using a regular href:

function clean(url)
{
location.href = url;
}

So we call this method from our anchor:

<p>Back to <a onclick="clean('index.html')">Main Site</a></p>

On site clean() takes us to index.html.