webpage

javascript to get paragraph of selected text in web page

别等时光非礼了梦想. 提交于 2019-11-26 08:08:55
问题 After highlighting text, I would like to obtain the paragraph in which the selected text resides. var select = window._content.document.getSelection(); Any pointers please? 回答1: This is actually rather hard to do because you have to consider six cases: The selection is not within a paragraph (easy); The entire selection is within one paragraph (easy); The entire selection crosses one or more sibling paragraphs (harder); The selection starts or ends in an element not within a paragraph (harder

Get text from web page to string

我怕爱的太早我们不能终老 提交于 2019-11-26 06:39:05
问题 I\'m new to Android and I want to get the whole text from a web page to a string. I found a lot of questions like this but as I said I\'m new to Android and I don\'t know how to use them in my app. I\'m getting errors. Only one method I managed to get it to work, it uses WebView, and JavaScript and it is slow as hell. Can someone please tell me some other way to do this or how to speed up the WebView since I don\'t use it at all for viewing content. By the way, I\'ve added the following code

How to use greasemonkey to selectively remove content from a website

人盡茶涼 提交于 2019-11-26 04:26:47
问题 The content I am trying to modify has a series of <div> entries, and within each of these are other <div> entries. There are no id tags to help here. What I want the script to do is inspect the content of each of these <div> entries and look for some text. This will be used to determine whether the whole \'\' entry is deleted/hidden or not. Is this possible? How? Below is an example. There are several of these in the page, and I want to delete/hide the ones where the text inside the <div

How to load external webpage inside WebView

ε祈祈猫儿з 提交于 2019-11-26 04:07:26
问题 My problem is that the webpage is not loaded inside the webview. mWebview.loadUrl(\"http://www.google.com\"); launches the web browser... This is the code of my activity: import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; public class Main extends Activity { private WebView mWebview; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWebview = new WebView(this); mWebview.loadUrl(\"http://www.google.com\");

Convert webpage to image from ASP.NET

笑着哭i 提交于 2019-11-26 03:28:11
问题 I would like to create a function in C# that takes a specific webpage and coverts it to a JPG image from within ASP.NET. I don\'t want to do this via a third party or thumbnail service as I need the full image. I assume I would need to somehow leverage the webbrowser control from within ASP.NET but I just can\'t see where to get started. Does anyone have examples? 回答1: Ok, this was rather easy when I combined several different solutions: These solutions gave me a thread-safe way to use the

JavaScript at bottom/top of web page?

陌路散爱 提交于 2019-11-26 03:09:18
问题 I was just using the plugin \"Yslow\" for Mozilla Firefox, and it told me that I should put JavaScript at the bottom. I have heard this before but haven\'t really thought about it too much. Is there really an advantage in putting JavaScript at the bottom of a web page compared to the top? 回答1: It'll allow the web page to load visibly before executing JavaScript, which makes sense for things like Google Analytics, which don't need to happen before the page loads. You may also want to look into

How to convert webpage into PDF by using Python

梦想与她 提交于 2019-11-26 03:06:32
问题 I was finding solution to print webpage into local file PDF, using Python. one of the good solution is to use Qt, found here, https://bharatikunal.wordpress.com/2010/01/. It didn\'t work at the beginning as I had problem with the installation of PyQt4 because it gave error messages such as \'ImportError: No module named PyQt4.QtCore\', and \'ImportError: No module named PyQt4.QtCore\'. It was because PyQt4\'s not installed properly. I used to have the libraries located at C:\\Python27\\Lib

How to change page in jQuery mobile (1.4 beta)?

假装没事ソ 提交于 2019-11-26 01:59:31
问题 I am reading the docs that $.mobile.changePage has been deprecated. But it doesn\'t say in favor of what, or what can I use instead. Is there a new API documentation page for this? I used to use $.mobile.changePage(\"index.html\", {reloadPage:true}); but it seems that adding reloadPage:true the page breaks 回答1: As of jQuery Mobile 1.4 , $.mobile.changePage() is deprecated and replaced with: $(":mobile-pagecontainer").pagecontainer("change", "target", { options }); Shortened ... $.mobile