UiwebView not resizable to page - uiwebview

my page (google for example) isn't adjust to my web view. Why?
The Same code in TestAViewController works.
Thanks a lot

Try this code
self.webView.scalesPageToFit = YES;
self.webView.contentMode = UIViewContentModeScaleAspectFit;

Related

How to scroll amazon offers page using puppeteer?

Hey I'm trying to scroll the amazon offers page using puppeteer but it is not scrolling and there is no mouse event happening.
This is the offers page URL.
https://www.amazon.com/dp/1416545360/ref=olp_aod_early_redir?_encoding=UTF8&aod=1
This is the selector I'm trying to scroll on the above page. #all-offers-display-scroller
I would appreciate your help regarding this.
I need to use the puppeteer own methods to serve this purpose.
You can use pressing space on main scrollable element. Ideally it works in most of the sites just by pressing space you can go down
Here's the code for the page you given,
const element = await page.$('#aod-container')
await element.press('Space')

How we can hide tabs on detail page in xamarin form?

Currently I am removing tabs and add again but still there is space top which not looks nice is there any other way thanks.
Try this:
var page = new NavigationPage(new Page1());
await Application.Current.MainPage.Navigation.PushModalAsync(page, true);

Portion of WKWebView that is beyond contentOffset.y = 0 is not clickable

I want to add a header above the web content of a WKWebView, the web contents will be scrolled over the header as the user scrolls up. So I set the WKWebView's contentInset.top = 200. ( height of the header view).
Everything is fine, excepts that when I scroll up, the web contents that are beyond the ContentOffSet( ContentOffSet.y < 0 ) become not clickable.
I tried the same with tradition WebView, there is no such problem. Anyone has any clue?
Thank You!

Using a Webview in a splitview controller

I'm having trouble displaying content properly in a splitview application. In the detail view I have a webview and I'm loading locally saved html files. However the files don't display properly - they are slightly zoomed in and missing detail on the left and right. Double taping them zooms them out and they display correctly. I have scaletofitpages=YES set.
Any advice?
Well, if i'm understanding you correctly, you can use auto layout.. it will fit your content from left and right.
to set the font size you must edit your html content add "css style" to them...
// Get result into string format
NSString *htmlData = [objSQLiteProtocol getDatabaseResults:fileNameToRead];
// reduce the size of font to set in iPad
htmlData = [htmlData stringByReplacingOccurrencesOfString:#"25pt" withString:#"12pt"];
[moreWebView loadHTMLString:htmlData baseURL:nil];
moreWebView.scalesPageToFit = YES;

how to change color of phonenumber in uiwebview in iphone

I have parsed html content to display in a webview.
There are phone numbers which are detected by webview by default, but those links are displayed in blue color, I want to change it to white color, how is it possible?
If anyone know please tell me..
Thanks in advance.
According to this question all you need to do is to set the a (hyperlink) CSS properties. See the answer of David Thomas. Specifically, he proposes this solution for just phone URLs:
a[href^=tel] { /* css */ }
You can change style color of your html content on server side or in client side.
For doing it from client side you must get first the elementId or class of your html content (you can do it from chrome with right mouse click on the link and selecting inspect element)
Then on your uiwebview (once it finished being loaded) you execute javascript for changing element color:
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSString *javascripString = [NSString stringWithFormat:#"document.getElementById(\"linkId\").style.color=\"white\";", m_studyId];
[uiwebview stringByEvaluatingJavaScriptFromString:javascripString];
}
The iPhone uses the current color setting in the a:link property. It uses that value even if the phone number is plain text and not enclosed with the hyperlink tag. If no CSS definition is set, iPhone uses the default. For those who may not know, you can set the values like this.
<head>
<style>
a:link {
color:#FFCC14;
text-decoration:underline;
}
</style>
</head>
If you do not have a CSS style setting for hyperlink then add it or Change the color to the color that works best for your webpage.
Try DarkDust solution. From client side it would be something like that:
- (void)webViewDidFinishLoad:(UIWebView *)webView{
NSString *javascripString = [NSString stringWithFormat:#"document.createElement('meta');meta.name='format-detection';meta.content='telephone=no';document.getElementsByTagName('head')[0].appendChild(meta);"];
[webView stringByEvaluatingJavaScriptFromString:javascripString];
}

Resources