How to Scroll the web content loaded on UIWebView to a specific division/content start point? - iphone

I am new to iPhone apps Development.
I am developing an application in which i need to scroll the webpage loaded on UIWebView to a certain div having some Id. Since I am loading the static webpage by converting the web content into a string. String contains some anchor tags appear on the HTML page. so clicking on the anchor tag webView should scroll automatically to particular div containing the same title as the anchor tag's title is.
I am using stringByEvaluatingJavaScriptFromString.
I have used a lot of javascript available on the net as well as on the stack overflow but none was feasible in my case.
Is there any solution for my problem.

Related

Get an image from a canvas HTML element in flutter?

In my flutter application, there is an image I would like to show that comes from another website. On that website, the image is actually a <canvas> element in HTML. I have seen resources about turning the Flutter Canvas into an image, or turning one's own <canvas> element into an image in JavaScript, but never anything about getting it from an external page.
The site I am trying to use is the NOAA Radar view. I could use a WebView to show the entire site but that seems needlessly heavy when I just need a still image.
What would be the best way about getting a still image from the site's <canvas> tag. I tried performing a http GET on the URL but there is no <canvas> tag present there when I do it in curl (via the html package). I believe this is because the canvas is rendered with JavaScript after the page loads.

Get only currently visible text

I know I can get the whole body of a document with context.document.body.getOoxml() and the current selection with context.document.getSelection(), however I can't find a way to establish what is currently on screen and what is not...
Is there a method in the Word Office JS api to retrieve only the content currently displayed on the screen?
There isn't a solution for this. The way some of the JavaScript libraries in web pages are able figure out this problem is through the view port.
Example here: https://www.customd.com/articles/13/checking-if-an-element-is-visible-on-screen-using-jquery
See another helpful SO answer here: Get the browser viewport dimensions with JavaScript
Now - Word however uses HTML as a way of formatting - and not as a way of directly displaying things. So even if you could run the same library on the HTML - it wouldn't have the same context.
The best you could do is to get the height of the visible space (which should be the same height as your add-in frame) and attempt to do some mapping. You would have some weird edge cases though, like if the font-size is different, or you have a page-break in the view etc...

setting view port before loading HTML page in iOS

I am an iOS developer and i do not have any knowledge about web development.I am trying to load an HTML page on UIWebView since the content size of web page is larger then the iOS device screen size,the webview shows scroll bars which has to be avoided in my case.I want to fit the page to the webview width.
I did read some posts here and understood that i should change the viewport of HTML to get things work as i desired.When i manually change the width and height properties of meta tag in HTML its fitting to my webview.What is the best method to change the view port before loading page.
(I have seen approaches to set scale using stringByEvaluatingJavaScriptFromString: in webViewDidFinishLoading: and i can not prefer doing this because the webview takes time to load the content till then it shows the scalled page then it refreshes.)
Is there any better method to change meta propertied then reading HTML file in to NSString and do poor string level manipulations?The HTML pages are always available locally on the device.
Please help,i need to get it fixed as soon as possible.

GXT Window hides behind iFrame in IE

In my GWT application, I have an iFrame embedding a PDF object. The PDF itself is retrieved from a servlet returning it with application/pdf as content type. In Chrome, my Popup, which is a GXT Window, shows in front of the embedded pdf just fine.
In IE however, the popup hides behind the embedded PDF, even if I make its z-index the max value for IE.
I have also tried to call the Window's focus method after loading it, and looked into alternatives for iFrame, but it led to nothing.
How do I make sure the popup Window will show in front of the PDF? What's causing the fact that the PDF brutally forces itself to the front in the current situation?
Internet Explorer has Windowed and Windowless elements - How the Z-index Attribute Works for HTML Elements. Embedded PDF is displayed using plug-in, so it cannot be behind plain DIV.
You should use the technique when an additional IFRAME is put in front of PDF plug-in, but behind the popup. This effectively will make the popup cover displayed PDF. It seems that GXT itself does not provide such a facility (or it does not work properly). You should probably implement your own popup window by extending the one being used. There you would override show() method to create and size additional IFRAME.
A good starting example is the implementation of PopupImplIE6 in GWT.

Annotating text in UIWebView

I am writing a app that has a UIWebView that displays a HTML5 page. I want to annotate some text on the web page and save it in SQLite database. The annotated text must be changed to a specific color as a visual effect.
Any suggestions that how can I select and get the text back in Objective-C?
You have two choices:
Parse the HTML5 document by hand
Inject Javascript into the page and walk the document. See Search and highlight text in UIWebView