How to load images using HttpClient API - httpclient

I have one requirement. I need to access one of our servers (web site) and need to read the content using the URLs and render it on the browser.
In our Application, I am using HttpClient API to access the web pages of one server (http://10.x.xxx.87). I am able to get html content/ web pages in the form of HttpResponse of HttpClient API. The content is sent from my application to the client, where the content is rendered in the browser.
Some of the lines from response,
href="/web/common/images/favicon.ico" type="image/x-icon"
href="/web/common/css/login.css" type="text/css
href="/web/common/css/overlay.css" type="text/css"
This href is pointing to the server I am referring from my application. I think this href location is trying to find the images or css files in my local server. I want the images to be read from the server which is I am accessing from my application.
How to solve this issue ? Help would be appreciated.

I was able to solve this issue. When the client request for the following image, href="/web/common/images/favicon.ico" type="image/x-icon", I am using servlet to read the response from other website.

Related

How to make Google crawler see asynchronously loaded data

I'm currently building a blog using Nuxt 3 + Axios to load data from a headless CMS.
Until the content is loaded, I display a content placeholder and replace it once the Axios request is done.
The request is launched on the Mounted hook.
I tried to preview the page using Google Search Console but the article content is not present on the page.
I'm worried that it will not improve the SEO rank of the website and I would like to know if I need to load the data on Server side and have it directly when the page is loaded and how.

Is there any way to get the HTML from a web page once the JavaScript is loaded in a Flutter app?

I'm working on a URL preview widget, so I'd like to extract the meta tags from the HTML of a given URL.
However, the problem is that websites like Twitter don't return the entire HTML when they detect there's no JavaScript engine enabled (i.e. doing a GET request from the http package).
So, I'd like to know if there's any workaround for these cases, for example, using some kind of headless browser to get the entire HTML.
Thanks!

Open a url from flutter with long list or URL parameters

I need to open a web page from flutter, and need to somehow pass a long list of data. I am currently creating a URL programmatically and passing the data through url parameters (ex www.mysite.com?param1=something&param2=... and opening the url with the url_launcher plugin. This is working just fine, until I create a url that is too long (which happens once in a while) giving me a http 431 error. I own the web page that I need to open, and can modify the way I am receiving data (get, post, etc).
A post request seems to be a better method than what I’m currently doing, but I’m lost as to how to send this data to the site within the body of a post request, and then open the site with this preloaded data.
Any help/ideas would be greatly appreciated!

Is it possible to add adverts to a custom Facebook Page Tab app?

I need to create a custom Facebook Page Tab app which will show an external site in an iframe. This need to have adverts on it but I'm not sure if this is possible as the site is hosted externally.
I'm not sure if I need to sign up to the Facebook Audience Network to get approved etc. either?
Any help or advice would be great.
Many browsers have this limitation of not allowing external sites to be shown in an iframe. Imagine the case when you are working hard to create a site and others show all your content in iframes. That is, naturally frustrating.
However, there is a candidate-solution: Let's suppose you create a page which sends a request to the other site and appends all the content into the body and head of your page. This is very much possible, so the solution is to:
Create a page in your site, let's call it outsider
In the server-side code of your outsider page send a request to the desired page to be shown
You will get the html of the page. Process it and include its content into the head and body of outsider. This includes:
3.1. Checking all the CSS to be reached, as the target page might refer to local CSS, which is unreachable locally at your end. Process the URLs of CSS files
3.2. Checking all the Javascript to be reached, as the target page might refer to local JS, which is unreachable locally at your end. Process the URLs of JS files
3.3. Apply the idea described in 3.1. and 3.2. for other resources, like images, until you are satisfied with the content of outsider
Create an iframe, having the source to point to outsider. outsider is inside your scope, so it should be shown
NOTE: If the site owning the target page does not like the possibility of you showing their content inside iframes, they might protect it by, let's say, having Javascript in their code, which checks whether the page is inside an iframe. Remove that code while processing the response to your request. If nothing else prevents you from showing the page in an iframe, then you should achieve success.

Grab contents of a webpage in GWT

Let's say that I have a link to a webpage that contains some text. What's the easiest way to grab this text to process?
Thanks.
Long story short, I don't think it's possible to make a request from the client js to grab the text from a url with a different domain.
It is possible to make requests to load json. This link describes how.
Basically, the steps are:
Embed a tag in the GWT page
after GWT page is initialized, update
the script tag's src to load remote
url
remote url returns some json data
padded inside a callback javascript
function such as:
callback({blah:foo})
So, you're only option may be writing a method on the server side that loads the url, gets the text. You could then call this method from gwt client using normal rpc technique.
Assuming same origin: use the "RequestBuilder" class.
If you are trying to grab a webpage from a different origin, then it obviously won't work.