JavaScript not working on Internet Explorer 10 - javascript

I'm on Windows 7, and just upgraded IE to 10. It works fine, except that Javascript isn't working. I know that it is enabled, as I can go into the settings and disable it, and then I get the "no js" output. But with it enabled, I get nothing. No errors in the JS console. The same script in Firefox gives me "hello".
Browser Mode is "10" and Document Mode is "Standards", though changing these doesn't yield anything different. Here is the entire page:
<!DOCTYPE HTML>
<html>
<body>
<script type="text/javascript">
document.write('hello');
</script>
<noscript>no js</noscript>
</body>
</html>
Similar results on other websites -- if I go to a page that uses Disqus comments, I just get a blank space. If JS were disabled, Disqus would return a message saying so.
Thanks.

I solve this problem.
F12 -> Disable -> Script (uncheck)

I don't know if this will fix your problem but your markup is invalid, run it through the W3C Validator to fix the problems then try again.

Related

How to debug/set breakpoint for JavaScripts in HTML or PHP?

For standalone .js files, we can easily inspect it in "source" panel of development tools and set breakpoint for them. But I often come across those js snippets that are in script tags in HTML, how do I set breakpoint or debug them?
Moreover, in Joomla, some js are written in custom HTML modules, and if there are some errors in the code, unlike for other standalone js files, where chrome comes up with clickable line of error, in this case chrome will only report something like "index.php/:54", and when clicked, it doesnt take you to the error point, and the supposed 'line number' itself is totally not helping.
So, for these two scenarios, how do I debug the codes? And also, in the second scenario, what excatly does the number means?
Modern browsers also give you the option of placing a single line into your script, containing:
debugger;
Which effectively places a breakpoint, hitting it stops the JS execution and brings up the developer console's debugging tools.
Of course, you can't have this in production code, but it's a great tool for development.
Edit: on second thought, I just tried placing a breakpoint in an html-inlined script of stackoverflow in Chrome 41, and it worked. Are you sure it doesn't work for you?:) (Maybe you didn't look under the right source in the sources panel?)
i hope it will help u..
<!DOCTYPE html>
<html>
<body>
<h1>My First Web Page</h1>
<p>
Activate debugging in your browser (Chrome, IE, Firefox) with F12, and select "Console" in the debugger menu.
</p>
<script>
a = 5;
b = 6;
c = a + b;
console.log(c);
</script>
</body>
</html>

Javascript suddenly stop working

I have asp.net project with Javascript code, i worked with Internet explorer 8, after i did finish the project i tried to run this project on All other browser (Chrom, Firefox, Opera, Safari) and suddenly each of these browser are not run javascript.
I was supprised that after 1 minutes i went back to the Internet Explorer and is also not running javascript.
I don't know what the problem, I've tried to comment partial of my javascript and it is not work, and comment all the left javascript and it's still doesn't work.
I have very long JavaScript code vith collaboration with AJAX, i have tried to remove paragraph by paragraph and it still doesnt work, i have tried to remove All the java script and run only "Hello word" simple java script code that fire from click event and it does not work. Although with other pages it work fine (alse the same "Hello word" simple code, the problem causes suddenlt til this moment every thing work fine. I attached sample code from the javascript code, it doesent metter because my there is a lot of java script code. Thank you every one that response i willi appreciation your response ! By the way there is none error, except when i click the button the java script write "
Better use some some browser plugins/integrations for checking javascript error. Try firebug in firefox or developer tools in IE. If you are doubtful of the path taken by your web application, try Fiddler to check your site.
If there is a referencing problem in case of master page usage or url routing usage or other then you can reference the javascripts and css in the following manner:
<link rel="stylesheet" type="text/css" href='<%= ResolveUrl("~/css/style.css") %>' />
<script type="text/javascript" src="<%= ResolveUrl("~/js/jquery-1.3.2.min.js") %>"></script>

Javascript document.write in IE 8

This is doing my head in, been chasing it all day. We have an ad server that calls a script on our site which then inserts code.
E.g.
Adserver page called in an iframe:
<html>
<head><title></title></head>
<body>
<script src="http://adserver/ad?s=728x90"></script>
</body>
</html>
The javascript returned by the script call above:
document.write('<script type=\'text/javascript\' src=\'http://partner.googleadservices.com/gampad/google_service.js\'>\n');
document.write('</script>\n');
document.write('<script type=\'text/javascript\'>\n');
document.write('GS_googleAddAdSenseService("ca-pub-xxxxxxxxxxxxxxxxxxx");\n');
document.write('GS_googleEnableAllServices();\n');
document.write('</script>\n');
document.write('<script type=\'text/javascript\'>\n');
document.write('GA_googleUseIframeRendering();\n');
document.write('</script>\n');
document.write('\n');
document.write('<script type=\'text/javascript\'>\n');
document.write('GA_googleFillSlotWithSize("ca-pub-xxxxxxxxxxxxxxxxxx", "Global_728x90", 728, 90);\n');
document.write('</script>\n');
This inserts Google Ad Manager ads onto our page. Problem is that the code doesn't work in IE 7 and 8, but works fine in Chrome, Firefox, Safari etc.
The "error" returned by IE is "Object Expected" and running it through IE's "Developer tools" doesn't help either.
I've tried a ton of things to get it working, splitting up the
It seems the error is happening whenever a GS_ or GA_ function is run, so I suspect IE is trying to stop external scripts from writing to the page?
Can anyone shed some light why the error is happening or a solution?
Thanks
I think it's simply because Chrome, Firefox, Safari etc., are faster browsers. They're downloading the file http://partner.googleadservices.com/gampad/google_service.js before executing the script that depends on it, whereas IE is still pulling the file at that point.
Perhaps you can include the contents of that js file in your own js somewhere?
I've seen this a lot since posting this question. As far as I understand it, it's a race condition problem that only exists in IE. Unfortunately there is no way around it.

Cant find the problem, IE appearance problem

I have this ajax_update script that updates file.php every 60 seconds.. Now file.php outputs this after updated a table:
<div id="message" style="display: none;" onclick="closeNotice()">this works
</div>
What I am trying to do is that after file.php have updated a field in the database(points), there will come up a message like stackoverflow at the top(just like when you earn a badge) saying that you have received 1 point. anyway:
Here's my update script:
function addpoints() {
var postFile = 'addpoints.php?userid='+ $('#user_id_points').val();
$.post(postFile, function(data){
$("#points").html(data).find("#message").fadeIn("slow")
setTimeout(addpoints, 5000);
});
}
Now, i have in my index.php, and a load function addpoints script..
But why will this only appear in FF and not in IE?
I have checked with w3c validator, if it could be unclosed tags or something, i fixed all problems and now i have no errors, but still it doesnt work.
So what to do?
You can see my site here: http://azzyh.dk/newgen/area/member/indextest.php
(use FF and you will see the message at the top, use IE and you wont see anything)
Im pretty lost. thank you
Display issues in IE can be a really pain i cant help you directly, But firebug lite which can be plugged into any broswer should help you see whats going on in IE
Firebug Lite
If you add the following as a bookmark and stick it on your tool bar it will enable firebug lite off any webpage with a single click.
javascript:var%20firebug=document.createElement('script');firebug.setAttribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');document.body.appendChild(firebug);(function(){if(window.firebug.version){firebug.init();}else{setTimeout(arguments.callee);}})();void(firebug);

inserting javascript in xslt not working in safari

I have a page that is pulling in an xml file uisng xslt. I need to add some javascript to it and have managed to get it all working in IE and FF but Safari is a no no. Here is the code I am using:
<SCRIPT LANGUAGE="javascript" DEFER="true">
<xsl:text disable-output-escaping="yes">
<![CDATA[
javascript here
]]>
</xsl:text>
</SCRIPT>
but I can;'t even get an alert in Safari?
Any ideas?
Try these couple of things first.
See if the code is even being rendered on the page and if it is being rendered correctly i.e no encoding problems, no weird characters etc.
If it is being rendered, try putting alerts and try catches around that code to see where exactly it is failing.
That will help you narrow down the problem.

Categories

Resources