Delphi TWebBrowser keep getting CloudFare page - delphi

When I use MS Edge, Firefox or Opera to access Cloudfare-protected webpages, it shows the page correctly. However, using TWebBrowser it always shows the Cloudfare captcha page first.
How do I configure Delphi TWebBrowser to act like a "real" web browser which does not invite the Cloudfare page?
Note that this is occasional access to the page, and yet it triggered the cloudfare when the other browsers do not trigger at that same point in time.

Not an real answer but some things i encountered with TWebBrowser on the "real" Internet.
The Sites i encountered needed different things.
Some needed a Header Information with specific Browsers.
Executing java script to read your system envronment for language (geoblocking)
Some need cookies obtained through cross site Scripting (Fraud protection)
and many other Things for various reasons.
So, for your Target Website you can sniff where your call beginns to differ from a working Browser. And then trying to reproduce the functionality for Your Application.
What you encounter is not a TWebBrowser Problem in itself. It is Browser Funtionality used to have Features like Geoblocking, Addblock detection or whatever. So you need to implement the missing Parts: Cookie Storage and/or Java Script.
The downside is: you only find one missing Part after the other. So when you start you dont know if you will hit a dead end. Doing "real Internet Sites" with TWebBrowser (based on IE 5.5) was not easy and that was around 2005 ... in the early easy days...
Optional: If you have an Invitation from the Site owner through an Api Key (or something similar for Authentification) it should work with the TWebBrowser. If all the "Protection" is not needed it worked on almost everyting.
I never found a solid working Solution, but changing the Header to be IE5.5, enabling the newer Mode(non legacy?) and Cookies + Script helped.
If possible try it with the new Edge Component or an embedded Chrome / Firefox / Opera.
In the End we used a microsoft IE COM Component and not the Delphi Component. But even then, not everything was working.

Related

Embedded orbeon: blank test page

I have an (java/jsp) embedded form builder (version 2019.2.0.201912301747) and I would like to use the test button, but I get an empty iframe on the popup window and indeed, the embedded fb-test-iframe iframe's src is an about:blank.
Although the same is true when I drop the orbeon.war to an empty tomcat and run the form builder there, there the test page works correctly (I have to add that I have implemented a custom persistence API for my orbeon instance, maybe I should have specified somewhere some related url, I have specified only the oxf.fr.persistence.${my persistence id}.uri .)
Unfortunately there is no network activity in the browser debug (maybe because of the iframe) and no browser error, it just does not work :(
Unfortunately the documentation does not really explain the way of working of the test button.
What and where should I configure in Orbeon to force it to, I don't know, raise an event that triggers something in orbeon to load something (ideally a form runner instance that loads the currently edited form) to there?
Update #1:
After switching to orbeon-2018.2.4.201911212304-PE.zip (but keeping the 2019 libs where it is embedded), I was able to get it to communicate, so I am a bit further. Now as it is visible on the picture, the embedded orbeon sends data to its backend, and the request arrived the orbeon backend according to its logs.
orbeon.war log
But there is no answer to the last request, this is the key I think, but I don't understand why. As if there would be a further call (maybe towards the orbeon CRUD API backend, and there would be no connect/read timeout for that connection).
But there is no further communication towards the crud api, there is no new entries in the crud api backend log.
My properties-local-prod.xml
Thanks in advance.
OP mentioned in a comment that this doesn't happen with an out-of-the-box install of Orbeon Forms, and thus suspects the issue they are having was due to some change they inadvertently made to Orbeon Forms.

Can we manage the silent print always by PHP or Jquery

print.print_always_silent use to print the page without print dialog box. My question is, can we do this my PHP / JQUERY code?. Please Help me how know well abt this.
I hope not. That would mean any website could print any document from my printer when they want. Would be a huge security hole imho
This is certainly not possible through the browser with PHP, which runs on the server. It's also not possible with javascript: browser security ensures that. Imagine what might happen if any web site could print whenever it wanted to.
There are (or were) ActiveX controls available for IE that enabled this. It might be possible with a browser extension for Chrome or Firefox if you want to explore that.
One other possibility is setting up a printer on Google Cloud Print and having your PHP server print directly to that, bypassing the browser altogether. Handling the authentication behind such a scheme could be tricky, but the API is documented on Google's site.

With firebug stop loading so can see requests

I am trying to analyze a POST request using firebug. Using the net panel I can see the request, however when the POST has success the page then reloads and I only have a couple of seconds to actually look at the request and see what is going on. Is there a way I can pause it much like when analyzing scripts using this tool?
There is a "Persist" button on some of the tabs in Firebug. Just make sure to click it before doing your post.
[edit] Second row, third button from the left, on the Console and Net tabs.
Even better, if you're on Windows you can use Fiddler - an amazing and free HTTP debugger developed by some important guy on the Microsoft IE team.
With it you can conditionally intercept GET or POST requests, inspect and change parameters, break on responses, change responses (headers or body), reissue old requests and generally screw with your application during development.
Simply one of the most useful web development tools. Ever.
May require a little tweaking for localhost - see here
One solution would be to remove the refresh of the page from your code.
Then run your code to see the results.
You can use web developer tools plugin for Mozilla firefox, and disable meta redirects

How can I detect when user browses certain url?

I'm writing an application, which becomes "useful" once user is browsing certain url.
I want to add feature to my application, that it will be automatically launched once user browses this url, I was thinking of writing some sort of watchdog to trigger it.
My question is, whether there is a generic way to get notified when user browses to urls, I want to support at least IE and FireFox, chrome and safari is nice to have.
I read about DDE and WWW_RegisterURLEcho, but from what I understand it's not supported by FireFox, and also little sample I wrote didn't work with IE as well.
Thank you in advance
some more questions **
Do Url Monikers and Asynchronous Pluggable Protocols help me here ? Is it supported by FireFox ?
If you have control over the website, you could have it write a cookie to the computer. Then have your application monitor for that cookie.
You can implement this in many ways and at many different layers.
At the highest level, you could implement a browser plugin. There is no cross-browser solution at this layer that will let you write the code once and work for every browser. On the easy end of the spectrum, Firefox, you could implement it entirely as a Javascript + XUL plugin and use built-in XPCom interfaces (nsIProcess) for launching your helper process. For IE you would need to write a COM, C++ and win32 BHO that handles DWebBrowserEvents2::BeforeNavigate2. This is the hardest thing to do. There are mechanisms for Safari, Chrome and other webbrowsers that you could use to achieve this same behavior, with varying degrees of difficulty.
At the next level you could implement an HTTP proxy, similar to Fiddler2, that redirects all HTTP traffic through your local proxy first. Each browser has a different way of configuring its proxy settings, but they're all basically registry settings or config files.
At the most basic level you could just snif all IP traffic going out of the machine, similar to the way Wireshark does it, and just look for http requests to your URL. This is probably more difficult to code, but would work for all browsers without any special per-browser configuration stuff going on. You may need to write a driver. I dunno, I've never done work at this level in the stack.

How to enable cookies for a pseudo-browser in Delphi?

I was testing an app from Marco Cantu's Delphi 2009 Handbook. This app, called AnonAjax (page 200), has some interesting features to recognize certain elements from a Web page and list them. This app uses anonymous methods with an internal Indy HTTP client component used to access to a given URL. As part of this app's functionality, it loads the first image listed. That's great, but with a Web page using cookies it does not load the image properly. I've tried with AllowCookies=true but it does not work. How can I enable cookies for this app?
you can attach a cookie manager (indy component) to the indy http client component.
Indy 10's cookie management is currently undergoing a major rewrite to address many issues that it has. It is likely that you are encountering a situation where the version of Indy you are using is either rejecting the server's cookies incorrectly, or is not sending them back to the server correctly. Unfortunately, I do not have an exact ETA as to when the new cookie management code will be ready for public use, but it is very close, possibly by the end of this month if time permits.

Resources