Hello world !
I have found a strange behaviour when loading a page containing CKEditor and an anchor in URL with Chrome (it seems that the problem doesn't appear on IE8).
My problem is that I use jQuery tabs jQuery button which inserts an empty anchor in URL when loading a tab clicking button, and I have multiple instance of CKEditor in my tabs on my page. So when my url is http://mywebsite.fr# the scrolling bar jumps to the last initialized editor...
To reproduce with a simple case :
go here : http://ckeditor.com/demo
and the go here : http://ckeditor.com/demo#
as you can see, when you load the second link (on Chrome), it jumps to the bottom of the page...
How can I avoid this behaviour ?
Matthieu
EDIT : the hash doesn't come from jQuery tabs but from jQuery button, I've easily found how to disable this hash insertion in URL so my problem is solved but I would be happy to know if it's a normal behaviour and if it can be disabled in CKEditor configuration...
that I use jQuery tabs jQuery
I'm not sure if I understand correctly but if '#' is inserted when you press jQuery button then it has nothing to do with CKEditor and editor doesn't have any influence on external code. Your tab button most likely has something like <a href="#" ....
When you click on such link in HTML then # is added to the URL.
To avoid this you could use javascript:void(0); or onclick handler. Please see this link for example:
http://stackoverflow.com/questions/6968911/what-is-the-difference-between-href-href-and-href-javascriptvoid0
If this was your problem then i will repeat again # inserted into URL has nothing to do with editor.
If however you are asking why page is being scrolled to the bottom and not top when editor is on it then yes this is interesting. My guess is that is may have something with editor gaining focus during initialization.
To reproduce with a simple
This is very weird. It happens only on Chrome (and perhaps other Blink/Webkit based browsers). I have no idea why... so I reported a ticket http://dev.ckeditor.com/ticket/10749 :).
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
@j.swiderski : you perfectly
@j.swiderski : you perfectly understood where did my problem come from. Thanks for the link, the correction I used is explained on the stackoverflow article you give :)
However, even if my problem was solved, I wanted to inform the ckeditor community I found a strange behaviour.
FYI, I use "startupFocus : false" so I don't think the problem comes from the focus.