I have been working with some Ajax functions. All of them are working very well. But i have noticed that sometimes, when the function needs to write something on a <div> it does, but all the text appears to move one space down. This happens only on Internet Explore and only sometimes, not everytime. This does not happen on the other browsers.
I know that maybe a part of code would be appropiate, but this keeps happens on many functions, and all my codes are very long.
I only want to know if someone has experienced something like this??
Thanks a lot
Is your code in UTF-8? If so, you're probably facing the wrath of the BOM (Byte-Order Mark).
The BOM is not required or even desirable. Make sure it is not there when you save your UTF-8 documents. For example, in Notepad++ there is the option to "Encode in UTF-8 without BOM" that solves the problem nicely.
If this is not an option, try this:
data = data.replace(/^\xEF\xBB\xBF/,'');
where data is what you just received from AJAX and are about to insert into the document.
Related
Hello i've been trying to do this for about 2 years. I think it worked once but ever since then i just can't make it happen again. Im adding this code to a block-
<a href="javascript:u=document.location.href;t=document.title; s=window.getSelection();
void(window.open("http://onlinebanter.com/node/add/web2ob?edit[title]="+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_link][0][url]='+escape(u),'_blank','width=600,height=500,status=yes,resizable=yes,scrollbars=yes'));">Test</a>
When i try to drag that to my browser the url comes out as so-
javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(
I am using the Full HTML filter option and isnt adding line breaks or anything. If i edit the link in my browser and add just
javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open("http://onlinebanter.com/node/add/web2ob?edit[title]="+escape(t)+'&edit[body_field][body]='+escape(s)+'&edit[field_link][0][url]='+escape(u),'_blank','width=600,height=500,status=yes,resizable=yes,scrollbars=yes'));
Things work great. I have looked about and have asked here previously
http://drupal.org/node/235074
I must just be missing something so simple as it seems the whole internet doesnt have this problem. All help appreciated thanks.
Reg`
I think the problem is with the double-quotes in your window.open() call.
The browser thinks that you're closing the href="javascript... "
Replace the double quotes in "http://onlinebanter.com/node/add/web2ob?edit[title]=" with single quotes.
I need to make the user to be able to select some text, click a button and make the server remember the selection for the next time.
I've extensively read through SO's questions and answers, tried some libraries, but without luck: haven't found a reliable tool yet.
It isn't important how the selection's boundaries are identified: it could be "nth textNode, mth char", or "nth char of text", or "nth char of html", or whatever, as long as it allows the server to identify the points in the document; what really matter is that, selecting the same words of the same document must give the same result on chrome, safari, IE, firefox.
EDIT: I don't need it to work everywhere on the internet: just on one site, where the document's structure is fixed and only the content of a single div (or the like) will change.
Try my Rangy library and its Serializer module. I'm not convinced it's exactly what you want because you mentioned the server remembering the selection, whereas my suggestion uses cookies, and the serialized selection will vary between browsers. However, it does do as you described in the first paragraph.
On the other hand, it's pretty much impossible to write something that will work for all browsers and all pages, since browsers interpret HTML differently and build different DOMs.
I have a few annoying problems.
The thing is, that when I am looking with Firefox every thing work perfect, after I try it with Chrome, sometimes happens that the code appears one web page (it is not all the time).
So, it appears in input text it display " />" or some piece of code of java script, which is written inside input tag.
The web page is: www.kalahoo.eu (do not try it in English )
In this picture you can see the problem:
http://rhc.si/slike/problem.png
Thank you very much for you help!!!
Can you post a link to the exact page with this error?
Either way, I would imagine that if you use the Chrome developer tools, you should get pointed in the right direction. Might want to give that a try.
You seem to be improperly escaping code that's making the HTML end before the rest of the attributes are read.
Check the spot in the code where its doing that, its probably a bad ' or " or even a >.
I am unable to replicate the problem when I want to but it seems like every now and then, my site using FCKeditor will load the interface but not the content (Clicking the buttons don't do anything). No javascript errors show and once it starts doing it, it usually is tough to get back to normal. The way I found to work best is to click the refresh button multiple times in a row, then the FCKeditor loads correctly. I have only seen this in Firefox
Has anyone else run into this problem or know a solution. It is a little annoying for me but I am afraid my client would be really confused
I have experienced the phenomenon you describe in FCKEditor's successor, CKEditor. Somehow, the IFRAME that contains the WYSIWYG content doesn't get loaded. What always helps is switching to source code view and back, but that's no solution.
I have seen the problem described on the Internet but with no solution.
Caching is not the problem, I think. Sometimes, if you press "reload" 20 times, it will break at the 21th time, and work again on the 22nd time.
What minimized the number of occurrences for me was to activate the thingy to the editor's bottom that shows the element path (body > p > span, I forgot it's name). I don't now why but since I turned it on, it very rarely breaks any more.
I have had this problem. I solved it by pre-loading FCKeditor in a hidden iframe during the login process so that when it got to the pages where it was used it was already in the cache.
i would strongly advise to upgrade to CKEditor which can not only be spelled out verbally without offending anyone, but also optimizes the loading time to minimal. I find it much more responsive than his F- friend.
I encountered this problem with firefox (not reproducible) and chrome (reproducible).
The solution that worked quite well in both cases was to wait for some milliseconds before initializing CKE :
setTimeout(function() {textarea.ckeditor({customConfig : 'custom/schnonfig.js'})} , 100);
Im not sure why is this happening but there is a piece of viewstate being shown on the top of my page with its closing tag.
I believe is just happening when there is some javascript code in the page, but is quite odd because has nothing to do with the ViewState at all.
Anybody knows anything about this?
Thanks,
Leonardo
any chance you could provide the offending code snippet and what precisely gets displayed on the page that shouldn't?
Based on what's been provided in the OP, it could be as simple as improperly nested tags
e.g.
<tag1><tag2></tag1></tag2>
Different browsers handle this problem differently, so it would come as no surprise that this produced unexpected behavior.
Similarly. different browsers also handle unclosed tags differently so watch out for that.