browser

Getting the number of files in a folder in java [duplicate]

给你一囗甜甜゛ 提交于 2019-12-21 10:18:16
问题 This question already has answers here : Counting the number of files in a directory using Java (9 answers) Closed 4 years ago . I'm making a basic file browser and want to know how to get the number of files in any given directory (necessary for the for loops that add the files to the tree and table) 回答1: From javadocs: http://download.oracle.com/javase/6/docs/api/java/io/File.html You can use: new File("/path/to/folder").listFiles().length 回答2: new File(<directory path>).listFiles().length

Render web page to picture

前提是你 提交于 2019-12-21 09:34:54
问题 I have the string with URL. For example "http://google.com". Is there are any way to download and render this page to picture file? ("test.jpg") I tried to use WebBrowser control, to download and render picture, but it only works when WebBrowser placed in displayed form. In other ways it's render only black rectangle. But i want to render picture without any visual effect (creating, activating form etc.) 回答1: Internet Explorer supports the IHtmlElementRenderer interface, available to render a

How to keep PHP 'View Source' html output clean [duplicate]

廉价感情. 提交于 2019-12-21 09:32:05
问题 This question already has answers here : How to properly indent PHP/HTML mixed code? [closed] (6 answers) Closed 5 years ago . This has been bugging me today after checking the source out on a site. I use PHP output in my templates for dynamic content. The templates start out in html only, and are cleanly indented and formatted. The PHP content is then added in and indented to match the html formating. <ul> <li>nav1</li> <li>nav2</li> <li>nav3</li> </ul> Becomes: <ul> <?php foreach($navitems

How to keep PHP 'View Source' html output clean [duplicate]

三世轮回 提交于 2019-12-21 09:30:10
问题 This question already has answers here : How to properly indent PHP/HTML mixed code? [closed] (6 answers) Closed 5 years ago . This has been bugging me today after checking the source out on a site. I use PHP output in my templates for dynamic content. The templates start out in html only, and are cleanly indented and formatted. The PHP content is then added in and indented to match the html formating. <ul> <li>nav1</li> <li>nav2</li> <li>nav3</li> </ul> Becomes: <ul> <?php foreach($navitems

Browser simulation - Python

帅比萌擦擦* 提交于 2019-12-21 09:22:18
问题 I need to access a few HTML pages through a Python script, problem is that I need COOKIE functionality, therefore a simple urllib HTTP request won't work. Any ideas? 回答1: check out Mechanize. "Stateful programmatic web browsing in Python". It handles cookies automagically. import mechanize br = mechanize.Browser() resp = br.open("http://www.mysitewithcookies.com/") print resp.info() # headers print resp.read() # content mechanize also exposes the urllib2 API, with cookie handling enabled by

Preventing tab to cycle through address bar

為{幸葍}努か 提交于 2019-12-21 08:05:06
问题 I realize this is probably an accessibility issue that may best be left alone, but I'd like to figure out if it possible to prevent the tab from visiting the address bar in the tabbing cycle. My application has another method of cycling through input areas, but many new users instinctively try to use the tab, and it doesn't work as expected. 回答1: Here's a generic jquery implementation where you don't have to find the max tab index. Note that this code will also work if you add or remove

How to cache an HTTP POST response?

限于喜欢 提交于 2019-12-21 07:57:24
问题 I would like to create a cacheable HTTP response for a POST request. My actual implementation responses the following for the POST request: HTTP/1.1 201 Created Expires: Sat, 03 Oct 2020 15:33:00 GMT Cache-Control: private,max-age=315360000,no-transform Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Content-Length: 9 ETag: 2120507660800737950 Last-Modified: Wed, 06 Oct 2010 15:33:00 GMT ......... But it looks like that the browsers (Safari, Firefox tested) are not cacheing the

How do I programmatically detect how a browser handles window.close()?

徘徊边缘 提交于 2019-12-21 07:47:00
问题 Different web browsers handle the window.close() function differently. IE prompts the user for confirmation, while Firefox and Safari just fail to honor it unless the window was originally opened with Javascript and display a message saying as much in the console. A third party web application used internally in our organization that I support displays a 'close' button at the end of a wizard-like series of pages. This works well for IE, which is what the majority of our users use. However,

JavaScript Detection / Browser Statistics

荒凉一梦 提交于 2019-12-21 07:37:26
问题 This has been asked few times but I think it's still worth checking with you guys for some more input. All my websites use Google Analytics for stats. Since it relies on JavaScript I thought it was important for me to check how many people actually have JS enabled in their browsers enabled/disabled. I remember I usually checked w3schools browser statistics, and recent results show something around 95% which was quite satisfactory for me. But since it applies purely on their website, I thought

Delete cookie from browser?

北慕城南 提交于 2019-12-21 07:09:27
问题 Is there any way of instructing a web browser to completely delete one's cookie set with PHP? I do not want to expiry it or wait for the browser to be closed . With delete I mean to actually not have it listed inside the cookie's list anymore. 回答1: You cannot force the browser to delete the file associated with any cookie, because you can't guarantee there's actually such a file - the contract between browser and web server regarding cookies is that the data will be presented at eligible