properly format HTML inside UILabel - html

I am fetching HTML content from online web service, I am using UILabel and rendering the HTML inside.
The issue that I am having is that sometimes the images/videos inside are being cut at the end of the screen(because there isn't enough room to display it all), because I am not using scrolling I am flipping into a new element, how can I make sure that images/videos are being cut, meaning I am displaying content properly. If I reached the end of the screen and I have no enough space to add an image I would like the image to go on the other page. Do I solve this programmatically using code? any existing sdk to help, or should I have the server respond with multiple objects each one for 1 element.

Related

html2canvas text alignment is off

I'm using html2canvas to allow users to download a div element to their local files as an image.
What they are saving is an image with dynamic text on top of it that changes based on their user input (this whole div becomes one image).
The saving part works, and users can save the div as an image to their local files. However, the dynamic text moves downward and the image looks off because of it.
I tried to make changes to html2canvas code based on someone's solution on github, but it didn't work and I reset this code to the original.
Is this a common problem that others have faced? How do I solve this problem without hard-coding the solution (moving the dynamic text up on the web application so when it moves downward when saving, it looks how it's supposed to look)?
Thanks!

following a link and returning back breaks mobile layout with viewport-fit=cover

I am struggling with PWA I made. I have the html meta tag viewport-fit=cover, which make sure that on phones with a pinhole camera or cutout, the app will stretch around it. When the pwa is added to the phones home screen and opened it works, but when I open a link and return to the "app" the whole camera area is a black bar and the content doesn't stretch around it anymore. Does anyone have a clue if there is a way to fix this behaviour?
I have only written one PWA. The whole App was one javascript file with one html page. Stepping through the app, did not change pages as the url remains constant. Therefore the back arrow does nothing on it. You have to code that action yourself.
In this case, something is not getting initialised again.

What is the best solution to show NEWS html body using Objective-C?

I'm building news app. I need to beautifully show the body of news in separate page. The body may contain bold, italic, images, links, paragraphs etc, the all kind of html tags occurred in article body.
Years before I would use RTLabel but it's not supported anymore. I wouldn't mess with old libraries.
I thought about UIWebView, but I need something more native and easy to customize. What you think?
What about TTTAttributedLabel, is it the right choice I should consider?
Use WKWebview for your purpose and it would serve you well.
As far as the customizing the WKWebview in between view and stretching it for its full content, YES you can do that as well,as long as the WKWebview content is a whole and you dont want a view in between the webview content.
Here's what you got to do --
Put a scrollview as the parent view.
Put some view as the subview of the scrollview.
Next create the WKWebview right after the content of the view, so that the WKWebview's y would start right after the y axis of the view.
Here is the tricky part.
Calculate the WKWebview content height and update the frame to that of the content height.
You can do this by printing webView.scrollView.contentSize.height in this delegate method of the WKWebview--didFinishNavigation
Put other views below the new updated WKWebview y axis.
Hope this helps

Chrome extension scrape text from one page and display inline onload

So I'm having a bit of difficulty getting started on this as I'm quite horrid with javascript. My goal is to scrape some text off of a page (that has nothing but the text I want on it) and load it inside of a floating div or something when I load another page.
In essence:
timer.html contains a timer that displays the current time and self-reloads every 10 seconds.
page.html is loaded, I want to display timer.html at the bottom of page.html
Note: I don't own any of the source involved outside of my test envir, otherwise there's a million easier ways to do this.
Can help me with resources or code examples?

Seamless FRAME/IFRAMEs (with reasonable scrollbars)?

Summary:
I'd like to display a shopping cart from another domain underneath my fixed content in my page - and have the scrollbars come out properly.
Details:
I need to display a shopping cart from a vendor within a page on "my" site with "my" header on top. (Eventually the shopping will all be in a subdomain but not now, sigh.) The header is a fixed height. The shopping cart pages vary in height as you navigate within that frame.
I've tried frames and iframes and had cross-browser issues with the iframes. I'm only testing four configurations, Windows/IE, Windows/Firefox, Mac/Safari and Mac/Firefox.
Right now I am using a frameset with two frames, one containing my fixed-height header page, the other containing the external page. This does work - the one issue is that when a scrollbar appears it (of course) only appears on the bottom frame.
This will do and the client isn't very sophisticated but it bugs me.
If I use IFRAMES, I find I need to sprinkle height: 100% and overflow-y: auto in various places - and yet I still cannot avoid either one of two unacceptable issues that appear in at least one of the browser/OS combinations...
The combined content is larger than the window, but no scrollbar appears.
An inner scrollbar and an outer scrollbar both appear.
Any hints appreciated!
EDIT:
Thanks for the work - but I don't think I conveyed the issue correctly.
I'm not using frames for layout - I wish simply to make a page framing something on another site (that hosts the shopping cart and whose URL should not be exposed).
Frames "work" - BUT having an interior scrollbar on the second frame and no scrollbar on the whole page is definitely wrong behavior. My client won't know this but it'll look amateurish to people seeing the page.
I don't see quite how a server-side include or CSS would do it and I know both fairly well. If I used the server side include, how would links internal to the shopping cart work? I'd leave my site, correct?
Summary: A shopping cart hosted on another site, embedded on my content page.
Don't use frames, if the user does command + click then the product will open in new window and your frame will disappear.
One feasible solution I see here is with Javascript:
Load the page via $.ajax
redirect all clicks so that it loads in ajax window by
$('iframe a').on('click',function(){
// load the product via AJAX
});
make sure height of Div is not fixed so that it expands automatically and scrollbars are there only on window.
This is best way I could think of keeping the integration seamless while hiding the url