I've got a problem making my ScriptManagerProxy expose registered scripts.
When I add a ScriptManager, everything works as expected and the scripts are reflected correctly, but whenever I change it to a ScriptManagerProxy, every script, even the MicrosoftAjax.js, dissapears from the intellisense.
I believe there is some sort of bug with the proxy, but could anyone shed some light on how I can fix this. It's getting quite tedious changing the ScriptManager to and from a proxy all the time.
By the way, I'm using user controls with embedded script resources, if that's of any importance (it all works with the regular ScriptManager, so there's nothing wrong with the code).
Related
I have a React project, that is nearly finished. So naturally I build it and configured my nginx server to host it.
For building I used react-snap (no serverside rendering applied here).
Now I have this really strange behavior I noticed. When I browse on my site, everything runs smooth and is fine. I can use all kinds of links on the site without problems. Reloading with Ctrl+R works fine as well. But as soon as I don't use any link on the page and don't open another tab (or make a browserreload of the used tab), but manually type in another urlpath of my site in the browser, while being on the site (any supage of the site really), it kind of crashes.
By crashes I mean, elements get completely distorted. It's like they are loaded on top of each other. Now the strange part of it is the fact, that this doesn't happen in dev, but only when I use the static files I build for prod.
Can someone recognise the source of this strange behaviour?
I mean it obviously has something to do with loading a subroute without using an internal link, while no full reload is performed.
I can provide as much additional information as necessary, if anyone may have a clue, where this behavior could come from. But really I don't know where to start, so I reduced the question to the pure description of what's happening.
Because of a system of dependencies that are less formalized than I'd like, I now have a very, very large "master" JS file that contains a pretty large kitchen sink for use in every page in my app; that is, once you've logged in.
It only takes a few seconds to load, but those few seconds aren't great for a first-time experience at the logged-in homepage. So, I'd like to find a way of loading my script on my login page, so that when the browser requests it on the homepage, it either gets a 304 Not Modified response, or simply knows not to re-request it. Here's what I've tried.
Just including the <script>
This unfortunately doesn't work because the script in question doesn't have "definition guards" in place. Including it on the page messes up the login page because of certain <div>s it expects to have present. It's built through dojo, and I don't want to hack the built file, so I don't want to surround its code in such a check.
Grab it with XHR
I actually had this fix in place for a while, and it appears to work okay in Chrome; once the login page is completely loaded, my script then sends out an XHR to "js/masterFile.js" and does nothing with it. The assumption is that as long as the cache headers are okay, the browser will hold onto it when it later needs that file as a script. As I said, it turns out most browsers don't seem to work this way. Some reuse the "text" they got from the XHR, others seem to cache scripts differently from other content; it's possible that's a security-related issue to them.
Load it in an iframe
This is kind of entering rocky territory, as I don't like iframes, and it's an extra request. But, doing this would at least let the browser cache the script in the right way. It introduces a lot of code complication though, and I'm hesitant to settle on this.
If it helps at all, the scripts are AMD-compatible; but, the master script in question is a "boot layer" that contains the basic definitions of require/define.
Well, I just found a possible way of doing this; I don't currently have time to thoroughly test it, but it appears to work on a basic level.
<script src="myMasterScript.js" type="text/definitelynotjavascriptnopenosir"></script>
This works in an interesting way. I can see that the request is made for the script source, AND if it's valid JavaScript, it will execute. (As found from just referring to the JQuery CDN) However, the browser's console will essentially squelch any kind of errors that occur from running it; ie, "Oh. Maybe I wasn't supposed to run that".
For my own purposes, I still need to figure out, based on the JQuery scenario, whether this might still mess up the page to some degree.
My problem is quite generic: I know that I have a JavaScript issue somewhere. Now I don't know how to start searching where the problem could be. Usually I use the Firefox built-in or the Firebug Debugger. I know how to use it in general. But what I don't know is where to start. Where should I set breakpoints? I often have this kind of problem.
As an example which is my current problem: I have a page with an unordered list. Every second list item is empty for some reason. I can see that the page gets loaded with proper list items. But then some JavaScript seems to add those empty items. It's a Yii application that inserts some JavaScript directly into the HTML but let the browser also load jquery.js, bootstrap.js and yii.js. I haven't added any own JavaScript.
Now, as I said, I don't know where to start to find the problem. It might be that I have done something wrong with some configuration. But it could also be bug. I just want to figure it out somehow.
With my current issue, the best would be to have a breakpoint on a function like onInsertEmptyListItemToCounfuseDeveloper() ...
I don't want a solution to my current issue. I'd like to know in general, where and how to start finding JavaScript related problems. Especially, with third-party JS. With some applications (CMS, shops,...) there are sometimes a lot of JS files. This makes it more worser.
I hope this question is answerable and you can provide some experiences.
Not speaking 'bout the CMS right now, but in general my method is
1) If you did not add any of your onw scripts, just 3rd party, delete them all of your project e.g.
You've added jquery.js, bootstrap.js, yii.js so you remove them and then you test if all works fine, if so, add first one, for me it would've been jquery.js, test again, if no bug visible add second and so on. In this case you'll see in which file is some bug or sort of unexpected behaviour.
2) Here is the worst part, in the found file you should find the problem part. So, download the full version, not production, open it in editor, and start searching... The good news are that you don't have to look through all file, just find the event listeners in your devtolls or firebug and follow them.
All of this is just my experience , so if someone know better methods, I would like to hear 'em too.
It would depend on the code. Generally, if I have a function that is suspicious, I put breakpoints or console.log() at the beginning and end of the function and see if both are executed. Then I follow the logic down to figure out which piece is broken. It really depends on the code though.
I have the following app.js file:
https://gist.github.com/manifestinteractive/393a4aae0c4ed4fb6bc2
When I look at files I am loading statically in the public folder via the operating system, they look correct, however, if I go to view them via the browser as intended for delivery through node express engine, the contents are duplicated. Basically, it is taking the file and appending it to itself, which of course breaks the javascript.
Anyone know why this would be happening? Suck a weird bug and I can't for the life of me put my finger on the cause.
For the record, I have tried looking everywhere for a solution. I've just not seen anyone talk about it. A quick test shows that I can manually change the JavaScript file at the source, and refresh the code in the browser, and it will reflect the changes correctly, but it will still be displayed twice.
Thought it might be some weird issue where maybe I had multiple instances of Node running or something, as that MIGHT explain it... but nothing :(
If I find what it is, I will follow up with the issue immediately, but for the time being, I am likely just doing something stupid someone here might yell at me for... and I would gladly welcome it :)
I've recently been stuck in an odd situation. I have to run a webpage through the .net WebBrowser. The site i'm running through it has rounded corners but because I'm running it through the IE browser it doesn't display them. I've been injecting some stuff already straight into the page (once it finishes loading) - Remember that. I first decided to inject CurvyCorners.js to allow it correctly display the rounded edges. Much to my dismay, however, CurvyCorners sucks and is severely glitchy. To get it to work in the first place, though, I had to go into the source and force it to run because it was waiting for the document to load, which it had, just only before the script was injected.
I've read online that Css3Pie works much better so I decided to try and get it to work instead. I've gotten it all to inject (the Css3Pie.js file injects fine and the HTC is loaded using the behavior css value). I can't seem to convince the HTC file to run without it receiving the loaded event. I've tried doing the same thing I did to CurvyCorners but even if I put the init() function call right at the end of the source code, nothing runs.
Does anybody know what I'm doing wrong? I can't seem to find any onloaded or ready events in the main Css3Pie.js file, I only find references to it in the .htc file.
You either user the js file OR the htc file. If you are using the .htc file, make sure you are sending it with the right MIME type (text/x-component).
The htc should run without any JS to trigger it.