I am having a problem but I am not sure where.
I have created a website which uses Angular, this might not be pertinent but then again it might be. Of the many features of this site one of them is the ability to upload a file and then get back a response. The response is a simple amount of JSON. The only browser I have to get this working with at this point in time in IE8. avoiding incoming thrown objects - I have tried everything to change this fact, but it is what it is.
I have gotten the site to mimic AJAX uploads by submitting a form and having the response redirected to an iframe. In fact I am using a module that does most of this for me.
So far all this works better than you would believe in IE8. I know right? Unbelievable!
But… there’s always a but…
I need to get this page working when running in a Webbrowser control in a winforms project. I get as far as uploading the file which happens successfully. My REST service gets it, saves it, and returns the correct response. When debugging I can even see that the response is available. But for some reason the load method for the iframe is never called. The iframe which I have made visible on the page is never populated with the JSON.
Again this works when running in IE but not when in the webbrowser control. I get no errors and have breakpoints and debugger statements everywhere. It’s like the response falls in a crack and is ignored.
Would anyone have any suggestions as to why this is happening? crossing fingers
Sorry for the delay I have been ..., well there is no adjective for how busy I have been.
The answer lied in the module that was chosen to help upload files. It worked for IE 8 straight up, but not when running in the web browser control. The module was dynamically binding an onload event to an iFrame which was also being dynamically create to handle the post back. Anyone that has worked with IE and needed to upload files might know of this method. This worked in IE8 but not in the web browser control. We modified it to add the onload event when the iFrame is created and that fixed the issue.
Related
I know how to inject my own scripts into web pages on load event, but it doesn't always work as expected. Sometimes the page succeeds to run its own scripts before mine and it makes my whole app fail. I try do disable the possibility the page spawns another browser window. I have an app running on my server, when it starts Internet Explorer instances randomly - it soon crashes the whole machine which is a disaster.
I made a script which changes window.open method and it does the trick perfectly - except the case when the page pops up another window BEFORE my code is executed. Is there a way to freeze JS before I finish injecting my script? Maybe is there a way to inject my script in an earlier point, before DocumentCompleted event? But how?
This doesn't directly answer your question about how to do it in the browser - but I'm aware of a similar thing that is done by Avast internet security and it does it using an HTTP proxy.
The idea is to intercept HTML pages as they are received over the wire, and inject your script into the HTML itself; thus there's no way that any other script can execute before it.
Whilst that might sound scary - you can do it using the technology underpinning the very excellent Fiddler HTTP debugger - the FiddlerCore API
I have a WPF browser application that collects user data and adds it to a database to tell them when their software is out of date.
All of that works fine, but the problem is when the application finishes its stuff, I want the web page itself to change (i.e., detect the web app has hit a 'finished' state, then autonagivate to a results page or something).
I can't think of a way to accomplish this, since the web app itself doesn't seem to be able to change the IFRAME it's contained in, much less the page outside of that, or signal to javascript or anything.
Any ideas?
I'd make an variable to keep progress/step of work. And a timer which would check if progress=="done" or sth.
Maybe this is not the best way of solving this but I don't know WPF much and that solution first came to mind
I'm trying to make a wrapper around last.fm and need to invoke some of the javascript functions in the page. Particularly the ones for Stop, Skip, Ban and Love.
InvokeScript seems to work fine with any script function that is within the page HTML itself, but not with scripts loaded from external script files.
For example, the actual call to the skip function is LFM.Flash.Player.skip(), so I tried the following:
_browser.Document.InvokeScript("LFM.Flash.Player.skip");
But all it does is return null and nothing happens on the page.
I've confirmed that that call at least works as typed using the Chrome inspector and the console. (Haven't figured out if there is a way to invoke arbitrary javascript in IE... any suggestions are appreciated)
Is there some special way that that function must be invoked?
Also, yes, I have tried it with and without the parentheses in the script call... still no luck.
Edit: To be clear, I am doing this in the WinForms Browser Control not in an ASP.NET page.
I had the same problem and that solved it for me:
Make sure there's no error in the console by manually loading the page in an external browser
IE Control seems to be caching the pages/scripts ==> I found that refreshing the page in the actual IE browser also refresh the page in .NET IE Control. You can also clear the cache with the debugging tools. I do this for everychange and it works ...
Hope this helps !
Aren't you missing parenthesis when calling skip? Otherwise this only "references" the function, it doesn't call it.
I am working on a system that after completing a record edit and returning control to the calling AJAX script, I refresh the calling page by calling a custom server extension. The odd behavior I am experiencing is after control is returned to the calling script, when the code hits window.navigate or document.location, it attempts to navigate to the url in a new window (which is not the desired behavior). Additionally, the custom server extension is never called - the url appears in the address bar, but then does nothing.
Does anyone have any idea what might be going on? I am running IIS 5.1 on XP sp3 and have tried to get it to work in IE 8 and IE 7, to no avail. Any help would be greatly appreciated.
Okay, my tech lead is apparently a much better Googler than I am.
http://www.faqts.com/knowledge_base/view.phtml/aid/13307/fid/53
Long story short: the page I am calling from is modal and only has an HTML rendering dll loaded. So we changed the return value of the modal page we called from a scalar value to an object with data and now I get to go repopulate the fields manually in the modal calling page.
One of the sites I maintain relies heavily on the use of ViewState (it isn't my code). However, on certain pages where the ViewState is extra-bloated, Safari throws a "Validation of viewstate MAC failed" error.
This appears to only happen in Safari. Firefox, IE and Opera all load successfully in the same scenario.
While I second the Channel 9 solution, also be aware that in some hosted environments Safari is not considered an up-level browser. You may need to add it to your application's browscap in order to make use of some ASP.Net features.
That was the root cause of some headaches we had for a client's site that used the ASP Menu control.
My first port of call would be to go through the elements on the page and see which controls:
Will still work when I switch ViewState off
Can be moved out of the page and into an AJAX call to be loaded when required
Failing that, and here's the disclaimer - I've never used this solution on a web-facing site - but in the past where I've wanted to eliminate massive ViewStates in limited-audience applications I have stored the ViewState in the Session.
It has worked for me because the hit to memory isn't significant for the number of users, but if you're running a fairly popular site I wouldn't recommend this approach. However, if the Session solution works for Safari you could always detect the user agent and fudge appropriately.
I've been doing a little research into this and whilst I'm not entirely sure its the cause I believe it is because Safari is not returning the full result set (hence cropping it).
I have been in dicussion with another developer and found the following post on Channel 9 as well which recommends making use of the SQL State service to store the viewstate avoiding the postback issue and also page size.
http://channel9.msdn.com/forums/TechOff/250549-ASPNET-ViewState-flawed-architecture/?CommentID=270477#263702
Does this seem like the best solution?