Issue 7 in mobile-bookmark-bubble: Hash parameter conflicts with jQuery mobile

179 views
Skip to first unread message

mobile-book...@googlecode.com

unread,
Dec 20, 2010, 5:59:09 PM12/20/10
to mobile-book...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 7 by jason.p.morrison: Hash parameter conflicts with jQuery mobile
http://code.google.com/p/mobile-bookmark-bubble/issues/detail?id=7

What steps will reproduce the problem?
1. Write a jQuery Mobile page
2. Use the mobile-bookmark-bubble script with the example ?bmb=1 hash param

What is the expected output? What do you see instead?

Ideally, it would not conflict. Since jQuery Mobile uses hash params as a
page addressing scheme, the usage of hash parameter here conflicts, and
jquery mobile tries to load a page via xhr e.g. "HTTP GET /bmb=1".

What version of the product are you using? On what operating system?

Latest HG head. iOS 4.x.

Please provide any additional information below.

I used a local variable instead, but am not completely familiar with the
ramifications. I'm not sure where/if this behavior should be changed or
just documented.


$(document).ready(function() {
setTimeout(function() {
var bubble = new google.bookmarkbubble.Bubble();

var varForHashParameter = false;

bubble.hasHashParameter = function() {
return varForHashParameter;
};

bubble.setHashParameter = function() {
varForHashParameter = true;
};

bubble.showIfAllowed();

}, 1000);
});


mobile-book...@googlecode.com

unread,
Dec 20, 2010, 6:03:18 PM12/20/10
to mobile-book...@googlegroups.com

Comment #1 on issue 7 by jason.p.morrison: Hash parameter conflicts with
jQuery mobile
http://code.google.com/p/mobile-bookmark-bubble/issues/detail?id=7

jQuery mobile's usage of location.hash for page addressing, history,
navigation:

http://jquerymobile.com/demos/1.0a2/#docs/pages/docs-navmodel.html

mobile-book...@googlecode.com

unread,
Jan 4, 2011, 12:47:22 PM1/4/11
to mobile-book...@googlegroups.com
Updates:
Status: Done

Comment #2 on issue 7 by ntho...@google.com: Hash parameter conflicts with
jQuery mobile
http://code.google.com/p/mobile-bookmark-bubble/issues/detail?id=7

Sorry for the late response -- I've been away on holidays for the past
couple weeks.

The idea behind using a hash parameter is that it will persist in the URL
across browser reloads and will be saved with any bookmark the user
creates. This lets you do things like:
a) detect when the user has bookmarked your app after seeing the bubble, so
you can track the effectiveness of the promo
b) avoid showing the bubble if the user has already seen it

There's a risk of a poor user experience if you just use a local variable:
if the user bookmarks your application and then comes back later by tapping
on the bookmark, they may see the bubble again, prompting them to bookmark
your application -- but they've already done that.

I've pushed a documentation update noting that this conflicts with jQuery
Mobile.

mobile-book...@googlecode.com

unread,
Jan 17, 2011, 9:02:53 PM1/17/11
to mobile-book...@googlegroups.com

Comment #3 on issue 7 by ntho...@google.com: Hash parameter conflicts with
jQuery mobile
http://code.google.com/p/mobile-bookmark-bubble/issues/detail?id=7

Issue 9 has been merged into this issue.

mobile-book...@googlecode.com

unread,
Jul 28, 2012, 11:41:28 AM7/28/12
to mobile-book...@googlegroups.com

Comment #4 on issue 7 by AndrewKo...@gmail.com: Hash parameter conflicts
As a workaround, I use the HTML5 history object to adjust the URL without a
page refresh, and without using the hash tag. This seems to work for me.
See below for code:

var parameter = 'bmb=1';

bubble.hasHashParameter = function () {
return window.location.search.indexOf(parameter) != -1;
};

bubble.setHashParameter = function () {
if (!this.hasHashParameter()) {
if (window.location.search.indexOf('?') == -1) {
window.history.replaceState('Object', 'Title', window.location + '?'
+ parameter);
} else {
window.history.replaceState('Object', 'Title', window.location + '&'
+ parameter);
}
}
};


Reply all
Reply to author
Forward
0 new messages