I have recently integrated MomentJS library into my application and have been running into a weird issue. Browser I have to use is IE9.
When I launch the application for the first time with zh-cn locale, I see a few junk characters in place of date and time. When I log out and log in again, then the characters load properly.
I check the encoding on screen and see it is UTF-8 both times. The issue is not consistent. I am at a loss as in what should I do to debug or get to the root of this issue. Any pointers about what I should check would be appreciated.
For integrating the MomentJS library, instead of
<script src="moment-with-locales.js"></script>
use this
<script src="moment-with-locales.js" charset="UTF-8"></script>
Related
Recently encountered a problem with a long standing asp.net c# program.
In my default.aspx amongst other things we have...
<script src="https://maps.googleapis.com/maps/api/js?key=...&libraries=geometry"></script>
<script src="/js/date.js" type="text/javascript"></script>
date.js is a utility library from http://www.datejs.com/
Just recently (last 6 weeks) our map is failing to draw anything, after a bit of investigation it seems that there's a toString() in one of the maps library files that tries to use the toString() from the date.js file and fails miserably.
Uncaught TypeError: format.replace is not a function
at Date.toString (date.js:40)
at iq (common.js:65)
at Object._.Bq (common.js:75)
at map.js:83
For the moment I can specify the version of google maps, 3.40 works fine, anything later doesn't.
Does anyone have a solution to this or has anyone seen this problem? Granted date.js is very old library now but I wondered if there's anything simply I can do.
Google suggests pointing to a more recent version of date.js https://github.com/datejs/Datejs/issues/88
I haven't checked it yet but confirmed it is failing with an old date.js
I am also getting the same error in version 3.41,
but after changing it to version 3.40, It works!
Ran into this same issue in a Rails app, updating data.js to a more recent version fixed it. There's a more recent fork that's available here that fixed the issue for me: https://github.com/abritinthebay/datejs
I'm trying to test my app on a new Samsung SmartTV 2013, however when I include google's ga.js locally into my bundle the TV rejects the app and will not install it at all.
The error message provided points to this page: http://www.samsungdforum.com/support/tvappssecurity. Which is pretty vague and unhelpful in this situation.
Any one have a work around for this? I've already looked on the Samsung D Forum.
Thanks!
The TVAppsSecurity is well known error - I have seen it tens of times. It basically says that your code violates Samsung security restrictions. In practice the static source code analysis on TV detects some security flaws.
Note that it is up to you to identify the issue and fix it. Since you know the file that causes the problem - you can easily separate it into test project. Then just start deleting portions of the code until you will be able to install the application. It is annoying, but it will take 60 minutes maximum. Note that sometimes it is even enough to rename the file.
I am not sure if the ga.js hosting is really a problem (see there https://support.google.com/analytics/answer/1032389?hl=en)
You can include ga.js by loading it from external host. In this case it will not be checked during install on TV.
I just realized that what is a nice and working layout of a form with a webresource in on-line version, looses some (but not all) of the formatting when accessed via Outlook. It looks ugly and, I also get errors.
It's somehow related to the JavaScript added to the solution. Or, rather, the web resources, I'd say. Any suggestions on how to debug? F12 doesn't show the console when run from Outlook. I haven't done much with that version so any hint might be of help.
Are you able to narrow down your problem to a part of the script? Could you for instance disable and enable parts of the script(s) to see what works and what does not?
Since the layout is also being influenced, I think you are doing some (or a lot of?) DOM manipulation. This page on MSDN states:
HTML DOM manipulation is not supported
But there should not be that much of a problem (heard that one before...) using Outlook: Dynamics CRM 2011 Outlook client and browser rendering
Edit:
Just to prevent people overlooking the link to a related post from the comments: Random JavaScript Errors in CRM 2011 Outlook Client
Although the page you see in the CRM-Outlook is indeed rendered by IE, it's being served from another version of the engine than what is used to browse. During the rendition process it's "picturized" (lacking a better word for it) so what you see originates in a webpage but isn't one.
I don't think there's a way to debug that version. You can only rely that the development you've tested will work as supposed to. Note that there's no connected process of IE run at the same time as the Outlook client.
I'll gladly stand corrected but as far I've tried (and I've tried a lot, a lot), there's no way to get there.
I have an asp.net mvc 3 project that I am developing in Visual Studio 2010. In the scripts section I have a library that I wrote. I made a change to the library. However, I notice that the change does not show up when the program is run in the browser. When I look in the debugger of firefox it shows the old version loading. I have tried cleaning the project, rebuilding, building, closing firefox, ctrl f5 on the page. How can I get the current version of the script to load?
There are two commonly accepted ways of doing this:
Option 1
Best option, in my opinion. Give the script a version number. Must remember to change the version number with every release
<script src="mylib_v4.3.js"></script>.
Option 2
The other is nowhere near as good because it can kill caching. Some browsers will re-request the script each invocation. (I really don't know the which browsers have which behavior.)
<script src="mylib.js?version=4.3"></script>
Option 3
The other option is to keep your scripts in a version directory.
Actually, in my PHP code I have
<script src="/js/ver##VERSION##/mylib.js"></script>
and my php code does a replace of ##VERSION## with the release version. This way my build scripts create a directory tree to upload and set paths right. If you have server side support, this method works very well.
Add a "version parameter" to the script reference :
<script src="/scripts/myscript.js?version=0.2"></script>
That method has the advantage of also doing the job when the your application is being used by clients, and you want to force their browsers to get the newest version when you update your app.
Clear your browser cache and disable it.
I tried to use Firebug Lite (via the bookmarklet and also adding it to one of my web sites).
I seem to get the alert:
Unable to detect the following script "firebug-lite.js" ... if the
script has been renamed then please set the value of
firebug.env.liteFilename to reflect this change
Alot. Especially when I try to close the tab. This happens in Firefox, Camino and Safari.
What I'm wondering is, is this ready for use?, or do I need to copy the code, post it locally and hack it? I already checked the documentation, and it was pretty limited.
I was also looking at the mod dates and the site appears to have been relatively idle since mid-2008.
The javascript file rounds out at 77,305 bytes, so I would think you would not want to use it on a production site unless you were using a dynamic language and could output the script conditionally when you need to do debugging.
(i.e. http://www.somefakesite.com/page?debug=true)
As long as you're only including the file in the page when you are actually debugging, it probably doesn't matter where you pull the script from unless it doesn't work correctly, in which case you would have to modify and serve it yourself.