Chrome problems - javascript

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 >.

Related

Clicking JavaScript in Ruby/Watir

Is there ANY way to click a JavaScript link using the Watir webdriver? I've looked around for hours and nothing has helped me.
Here's what the link looks like: MULTIPLY YOUR BTC
I've tried using browser.link(:id, "double_your_btc_link2").click and a bunch of other stuff including Xpath (it kept saying it couldn't follow the path) and nothing works. Is it even possible?
If you need the page, here it is.
That should have been:
browser.link(:id => "double_your_btc_link2").click
Sorry to waste your time, guys. I just used Firefox instead of Chrome and it worked fine. This isn't even the first time I've had a problem with accessing JavaScript elements in Chrome...thanks anyway.

Ajax: blank space on IE

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.

Adding Bookmarklet Javascript to Block?

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.

IE6 Won't Display a Javascript Tooltip... how do you even begin to debug this?

I am using a tooltip plugin (developed in house by someone who is on vacation) that works everywhere but in IE6. Naturally, it is being used on a site by people that use only IE6 so I need to find a way to get it displaying.
How would you even start to debug such a thing? I've Googled for the problem to see what other javascript tooltip plugins have done to deal with this but cannt find anything that pertains or solves my problem. So, I would love to debug it myself but I really don't know where to begin!
How would you start trying to crack this nut?
Some code:
In the html we insert the following (with display:none set in the css)...
var noteContainer =
'<div style="float:left;" class="ttip-container">
<div class="ttip-box">
(<a class="ttip_heading" href="javascript:void(0)">notes</a>)
<div class="ttip" style="background-color:#ffffff;">
<h3>Notes</h3>
<div class="subhead">' + noteMessage + '</div>
<div class="subhead_bottom">Click <em>(notes)</em> to ' + actionCap + '</div>
<img class="point" src="img/hovertip.gif" width="18" height="14" />
</div>
</div>
</div>';
Then the plugin sets this to diplay:block on hover over an anchor link.
So... where would you start debugging an IE6 javascript issue? I have IE6 running in a VM so I can work with it... just can't get it to tell me anything about what might be going on.
Install the IE developer toolbar, and install Visual Web Developer Express (which has a real debugger)
Is the HTML actually being inserted into the DOM properly? If there's a parsing error the DOM methods in IE will choke (can't insert invalid HTML in IE6). This is step 1. Make sure the markup is actually there (view source is fine).
Then see if your event is firing: put an alert inside the (presumably) click handler. See if your css-changing function is actually firing.
Then see if your css-changing function has a handle on the object. Try something like alert(this.tagName) (or e.tagName, or however else you might have a handle on the element to show/hide).
Let us know how those go.
In this case, I would use the IE Developer Toolbar to see if the HTML was properly appended to the document. If it is, then we know that the problem is not with the statement you pasted into your question. If it's not in your document (in which case you're probably receiving a script error), I would try gutting your tooltip's HTML string to
var noteContainer = '<div style="float:left;" class="ttip-container"></div>';
Test if that's appended correctly. If so, progressively add more of the tooltip content until you get your error. At that point you'll have a much better idea of what is causing IE6's parsing error.
In general, 'Old school' debugging in IE6-7 using alert() is still effective in many situations.
Visual Studio and Visual Web Developer Express are great options, but they're a little heavy on the system resource side, and could be annoying to work with in a virtual machine.
Getting IE to work with JS that works in every other browser is a major pain, so my sympathies for that.
What I would do in a case like this is crack open the source that's actually generating and displaying the tooltip on the page. Throw some alerts in there or change document.title at different points in the code. See if it's even making it to the portions where a tooltip should be appearing.
If it is making it to the "rendering" stages of the code, change your debug setup to tell you what's inside the tooltip element, what the element's size is, etc. As much information about the tooptip container as you can gather. Something in there might stick out, like an element with 0 width/height or completely missing data.
Basically, I'd try to narrow it down to either a "data pulling" or "rendering" problem.

AspNet ViewState piece showing on the page with Google Chrome

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.

Categories

Resources