Bootstrap: prevent jump to content when clicking tabs

Recently I had to add tabs to a website and ran into not wanting the browser to jump to the panel content when tabs are clicked. I just want the content to switch.

After a little research, I found posts explaining how to obtain the opposite, and a little later found this:


After giving their suggestion a try, I noticed that the path part of the URL was not being preserved (it could as well be something else on my javascript code), but anyways, here's what I have now:


// Change hash for page-reload
var url = document.location.toString();
if (url.match('#')) {
    $('.nav-tabs a[href=#' + url.split('#')[1] + ']').tab('show');
} else {
    $('.nav-tabs a[href=#tab_account]').tab('show');
$('.nav-tabs a').on('', function (e) {
    var url = document.location.toString();
    if (url.match('#')) {
        //$('.nav-tabs a[href=#' + url.split('#')[1] + ']').tab('show');

        url = url.split("#")[0];
    history.pushState( null, null, url + $(this).attr('href') );


Hopefully that telps someone else.




Weird: FCK loses first line of formatted text when submitting

Last night (Oct, 28th), I was fixing a very weird problem where text edited using FCK, submitted via jQuery was losing the very first line when it was formatted (color, style) but not every single time… randomly it seemed.

At first, I thought it would be something wrong with FCK editor and checked if there was an updated version. I was using 2.5.x on my site and 2.6.5 is current in the 2.x series (and 3.0.1 was just released, note: checking that for another website []).

Since I didn’t want to introduce new features (cause my client freaks out when I do without letting him know), I thought I’d give 2.6.5 a try. That did not solved my problem.

My next logical step was checking how jQuery was encoding the text to preserve quotes and double quotes and making sure PHP was getting that right. Which both were.

Next, I tried adding slashes and stripping them down, which also did not work.

At this point, I thought about changing my Ajax approach…..  but before that I’d though I’d give JSON a try.  🙂

So this is the changes I’ve made in my coding:

Javascript side (My text is edited inside a dialog window (created using jQuery-UI) and then posted using Ajax, from the main window.

var new_text = $('#frame_frontpage').contents().find('#previewMyStoreMessageBoard').html();
var str = $("#form_frontpage_text").serialize();
var This = this;
$.post('/member/store_home_page/ajax_save_frontpage_text', str,
$.post('/member/store_home_page/ajax_save_frontpage_text', {frontpage_text: new_text},
  function(text) {
    if (text == "success") {
    alert("Store Description Text submitted successfully.");
  } else {

Besides that I just added addslashes() and stripslashes() to preserve double quotes to/from the database.
And it’s now working 😀

  • IGlr