IE 10 Cache issue? - javascript

I have a very simple page that is loading 4 scripts.
jquery 2.0.3
jquery ui 1.10.3
knockout 3.0.0
knockout mapping 2.4.1
This only happens in IE. I have tried it in both 10 & 11;
I navigate to the url and the page loads fine. if I refresh the page still OK. If I go to the hit Enter in the address bar expecting it reload, it does but I get SCRIPT70: Permission denied errors, saying permission denied. Any ideas? Is this a local security settings policy with IE?
Here is the markup:
<html>
<head></head>
<body>TEST
<script src="/MyVirtualDir/Scripts/jquery-2.0.3.min.js"></script>
<script src="/MyVirtualDir/Scripts/jquery-ui-1.10.3.custom.min.js"></script>
<script src="/MyVirtualDir/Scripts/knockout-3.0.0.js"></script>
<script src="/MyVirtualDir/Scripts/knockout.mapping-2.4.1.js"></script>
</body>
</html>

I am not sure if this will help but this worked for me in IE10
Here's something to try:
Make sure that HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_OBJECT_CACHING\iexplore.exe is not set to 0 (it should be 1 or missing)
Reference: http://forum.jquery.com/topic/strange-behaviour-in-ie9
I don't think it has anything to do with jquery/js
Or Try this: Tools>Internet Options>Security tab, click "Reset all zones to default"

Related

Loading a txt file with jQuery [duplicate]

I am trying to get into jquery/ajax and I can't even believe I can't get past this first test. I'm following an example I found at The Jquery API site and I followed it just about to a T.
I created a local folder on the desktop, and added 2 files.
index.html
and
list1.html.
Index.html:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<div id="stage">
</div>
<script>
$( "#stage" ).load( "list1.html" );
</script>
</body>
</html>
list1.html
<div id="list">
<li>Test</li>
<li>Foo</li>
<li>Bar</li>
</div>
I was trying for like 15 minutes to run index.html in chrome and nothing displayed (like the jquery wasn't loading correctly). Out of pure curiosity I opened it with firefox and it displayed as expected.. something like this
Test
Foo
Bar
So is this a browser issue? Why does Chrome and IE not show this loaded list, but firefox does? I can't figure out if it's my code or the environment which is infuriating when trying to learn.
Try launching chrome / chromium with --allow-file-access-from-files flag set
See How do I make the Google Chrome flag "--allow-file-access-from-files" permanent?
Try
<script>
$(function(){
$("#stage").load("list1.html");
});
</script>
If still not works, check the Network section in the Developer Tools of your browser and see if there are any HTTP or Security errors.

JavaScript in Firefox calculates wrong values on pages served by Java App Server

Here's the case. I've got simple html page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample</title>
</head>
<body>
<script type="text/javascript">
alert(screen.width);
</script>
</body>
</html>
Code is in file sample.html
When file is opened under Firefox v41.0 it shows only JS popup with value 1366 (that's my screen width).
When I put this file into running Tomcat 7.0.61 working directory and try to access it using address for eg. localhost:8080/appCtx/sample.html, the JS prompt have value 1252. A little bit too small.
The same page opened under Chrome or even IE8 gives proper value.
I've tried using
window.innerWidth
document.body.parentNode.width
$(window).width()
All with the same result.
I've tried using onLoad or setTimeout(2 sec) - same result.
I've even put this file into working dir under JBoss 6.4 (project i'm workign on in my job) - same result.
All plugins in FF are disabled.
So my question is: why JS in FF can't calculate proper window width and height when page is served by application server (servlet container)?
You've probably zoomed in that page and Firefox remembered it. Press Ctrl+0 to reset zoom level (or use the menu) and try again.

AddThis on iPad

I have this AddThis:
<a class="addthis_button addthis_default_style">Share Site</a>
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=myid">
</script>
Looking good everywhere ...When clicked, I get the modal box/pop box with my sharing links...but when I click on iPad nothing happens...anyone know how to get this resolve?
Here's what I get running that code in the iPad simulator: http://i.imgur.com/4dYXnYw.png
Can you point me to a URL where you're running this code? The issue might be with how our code interacts with other elements on your page.

External JavaScript Files will not execute in IE9

The following is a snippit from my a little web page I'm putting together.
<script type="text/javascript" src="head.js">
</script>
<title>CPST 3410-85 Class Template</title>
</head>
<body onload="outputToDiv();">
The head.js file referenced in the script tag is below:
function outputToDiv() {
alert("JavaScript is working!");
}
In Chrome and in Firefox the alert is displayed indicating the JavaScript is working. In IE9 it is not. Furtermore I can't get ANY external script to run in IE9, regardless of the content. I have used custom security settings and lowered in a granular way every security setting to its lowest level, and gone into advanced settings and enabled literally everything I could find.
It should be noted that I am opening this from a local folder. All files are in the same folder, and again I stress that this works in firefox and chrome.
In IE9 I have enabled debugging and I get the error below:
Webpage error details
Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: file:///E:/My%20Documents/My%20Web%20Sites/CPST341085/head.js
Of course it then tells me that "outputToDiv()" is undefined.
I am at a total loss here.
I got this behavior when I had:
<script type="text/javascript" src="jquery-1.7.1.js" />
However, this fixed it:
<script type="text/javascript" src="jquery-1.7.1.js"></script>
Go figure...
David

(YUI2 javascript) - JavaScript does not work inside yui dialog

I try to insert JavaScript code to YAHOO.widget.Dialog.setBody(...), bit this does not work in Chrome (I have Ubuntu) (In Firefox the code is working)
The html file (simple example that not working in chrome browser):
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.2r1/build/container/assets/skins/sam/container.css">
<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.8.2r1/build/yahoo-dom-event/yahoo-dom-event.js&2.8.2r1/build/container/container-min.js"></script>
</head>
<body class="yui-skin-sam">
<script type="text/javascript">
previewDialog = new YAHOO.widget.Dialog("previewDialog", { width: "600px", visible: true});
previewDialog.setBody('<h2>h2 text h2'+'<script>'+'alert("alert text alert");'+'<'+'/script>'+'</h2>');
previewDialog.render(document.body);
</script>
</body>
</html>
How can be my code fixed for working in chrome?
(In real project I try to insert more complicated javascript code)
I don't have a solution, but I am having the same problem.
I opened up Google Chrome's built in developer console and see several warnings:
[blocked] The page at https://c.na15.visual.force.com/apex/SkillsMatrix?core.apexpages.devmode.url=1 ran insecure content from http://yui.yahooapis.com/combo?2.7.0/build/yahoo-dom-event/yahoo-dom-event.….0/build/animation/animation-min.js&2.7.0/build/container/container-min.js.
SkillsMatrix?core.apexpages.devmode.url=1:1
[blocked] The page at https://c.na15.visual.force.com/apex/SkillsMatrix?core.apexpages.devmode.url=1 ran insecure content from http://yui.yahooapis.com/combo?2.7.0/build/container/assets/skins/sam/container.css.
SkillsMatrix?core.apexpages.devmode.url=1:3
[blocked] The page at https://c.na15.visual.force.com/apex/SkillsMatrix?core.apexpages.devmode.url=1 ran insecure content from http://yui.yahooapis.com/combo?2.7.0/build/yahoo-dom-event/yahoo-dom-event.….0/build/animation/animation-min.js&2.7.0/build/container/container-min.js.
SkillsMatrix:1
[blocked] The page at https://c.na15.visual.force.com/apex/SkillsMatrix?core.apexpages.devmode.url=1 ran insecure content from http://yui.yahooapis.com/combo?2.7.0/build/container/assets/skins/sam/container.css.
I think the problem (at least for me) is that Chrome is most vigilantly enforcing a "Same Origin Policy" (cf. http://en.wikipedia.org/wiki/Same_origin_policy ).
The Force Times ( http://theforcetimes.wordpress.com/ ) currently writes about using an "AJAX Proxy" which may help to resolve some such issues. (His article is SFDC-centric but perhaps the principle will help if this is the problem you are having and you can establish your own proxy somewhere.)
It requires additional button-min.js and element-min.js with corresponding CSS as well.

Categories

Resources