Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows Forms WinForm
Hello,
Alright guys, sorry for bad question, I'll try to explain it better. All I have is simple webBrowser and I want to try to use it to avoid popping message from random server. That "popping message" looks exactly like normal message box but since somebody told me there's nothing like message box from server then I have no idea how to call it Big Grin | :-D . It pops out when you click on the button on the website. So I was thinking about if there's some kind code which can close/block it without user needing to interfere. Maybe some kind of block using the message's header would be enough Smile | :) . But after searching for hours all I've found was INewWindowManager interface and I just couldn't get it to work. I don't have any special codes for this I just use webBrowser and websites where I'm trying to do this are not mine so I can't provide any code of mine.
Thanks for any help!
Posted 27-Feb-13 7:55am
Edited 27-Feb-13 9:01am
v3
Comments
Sergey Alexandrovich Kryukov at 27-Feb-13 13:57pm
   
There is no such thing as "message boxes from server". Without appropriate code sample, who know if you screw up something and where?
—SA
AspDotNetDev at 27-Feb-13 14:33pm
   
In the past, I have created instances of WebBrowser controls (on the server) in order to render web pages, which I then embedded into PDFs (when then got served up to the client for download). If some JavaScript initiated an alert() during that process, that could potentially screw things up. I suspect this is what the OP is talking about, but OriginalGriff is right that they should clarify so we don't waste our time trying to read their mind.
OriginalGriff at 27-Feb-13 13:58pm
   
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
loctrice at 27-Feb-13 14:05pm
   
I'm saving this for proof that you can't do the things mentioned. I will use it against you in the lounge some day for sure.
OriginalGriff at 27-Feb-13 14:15pm
   
-shhh- I'm trying to hide my super powers.
Sergey Alexandrovich Kryukov at 27-Feb-13 14:45pm
   
OK, you did not really properly mentioned something. In my opinion, you already earned extermination from this site: for plain lie and attempt to manipulate. OriginalGriff does not look like a person easy for manipulations though... :-)
 
You got an abuse report from me.
 
As to the the "use it against... in the lounge"... have you heard the saying: "only slaves revenge"?..
 
Good luck,
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

As far as I understand you need to block message boxes like alert(), or confirm() to make sure that they'll not stuck your scripts. If yes, what can I suggest is to render (execute) following script in your hidden browser:
 
alert = function(){};
confirm = function(){}; 

 
Works perfectly for me in chrome, firefox, and doesn't work in IE.
  Permalink  
v2
Comments
LosEagle at 28-Feb-13 2:41am
   
Yes you perfectly understand what I need to do :). But I need to make webBrowser from Visual Studio to do this and the problem is that VS uses IE :(. But thanks for help anyway! Will note this answer as it seems useful.
Volodymyr Bobko at 28-Feb-13 5:40am
   
Just checked once again and -
it doesn't work in IE8 and IE7, and works fine in IE9.
 
But in IE 8/7 you can achieve the same result with the following script:
var alert = function(){};
alert(); // do nothing
LosEagle at 28-Feb-13 11:11am
   
This looks like it can work but how can I please use this? I'm totally new in scripting so sorry for stupid questions.
Volodymyr Bobko at 28-Feb-13 15:26pm
   
If you can preprocess web page HTML before passing it to your browser you can insert this script directly into your web page.
<script language="javascript">
var alert = function () { };
var confirm = function () { return true; }
</script>
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 604
1 thatraja 380
2 OriginalGriff 236
3 Gihan Liyanage 210
4 kbrandwijk 204
0 OriginalGriff 737
1 Dnyaneshwar@Pune 604
2 Kornfeld Eliyahu Peter 505
3 Sergey Alexandrovich Kryukov 405
4 thatraja 370


Advertise | Privacy | Mobile
Web04 | 2.8.140902.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100