Question

I am writing a facebook-like chat appliation, and (as in facebook) at the top of each chatbox I have added a link that opens the associated user profile when clicked on. The html for the chatboxes is dynamically generated using javascript/jquery.

The problem is that in Firefox this link is not "right clickable". While in Chrome this link is right-clickable.

So, I have two questions 1) why is this href not right-clickable in Firefox. 2) Is there a better way that I should be adding dynamically generated href's to my code using javascript/jquery.

Currently, I am using (in pseudo code):

$('#chatbox_identifier').wrap("<a href=link_to_user_profile></a>") // set once
$('#chatbox_identifier').text("UserName/Status text")  // can be set many times

Note: the Username/Status text can change depending on if the user is Idle/Away/Online, and therefore will be reset every time a users online status changes. This is part of the reason why I have wrapped it in the anchor (since the anchor never changes - I am only updating what really needs to be modified).

"Bonus question": is there any reason why the following should not show up as a "clickable" hyperlink when dynamically generated (in pseudo-code):

$('#chatbox_identifier').html("<a href=link_to_user_profile>UserName/Status</a>")

This is the first approach that I wanted to take, but I could not get it to work.

Any help would be appreciated.

Regards

Was it helpful?

Solution 3

It turns out that the chatbox code (for which I am not the original author) had the following declaration:

uiChatboxTitlebar.find('*').add(uiChatboxTitlebar).disableSelection()

This resulted in preventing right-clicks in Firefox.

regards Alex

OTHER TIPS

Could you post the actual HTML that is being generated by it? Maybe that will help. Links are sometimes not clickable when you haven't set an HREF value.

Your pseudo-code seems to be ok. Maybe you should post some real code, it may help understand what is going on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top