Load web page through html img? - html

I have a PHP file that I'm trying to get to load via an image tag:
<img src="https://example.com/tracker/">
I can see in Firebug that the PHP page is technically being loaded. But since it's not actually an image, it looks like not everything from that page is running - like Javascript that's supposed to run tracking certain visitors.
I'm probably just going to add all the javascript and stuff into the footer of each page instead, but I still don't understand why this didn't work.
Didn't affiliates used to load web pages as images for cookie stuffing like 10 years ago? I was under the impression that the page itself should load when being called, even as an image.
Or is it not loading as a result of some sort of browser security setting?

Loading an image that way won't treat the result as HTML and certainly won't try to run any javascript in it.
What that is good for is that /tracker/ can be a web application that does something with the request. Instead of just retrieving an image, it can increment a hit count or inspect a cookie. Then it can return an image of some kind, even if it's a 1x1 transparent PNG.
If you want to execute Javascript, then use a Script tag instead.

Related

Is there a way to make a non-redirecting search engine?

I'm trying to make a search engine, that will display every website content inside of the website, meaning that the computer won't detect that you even went on the website.
what I have tried:
I have tried to use the fetch function, and it did work, but there were 2 problems:
Only the html code displayed, so there was no css, or is, unless it was in the or tag.
90% of fetched websites returned an error, stating that I needed to enable something in my fetch command, but when I did, no html content popped up.
I've also tried using an api that somebody made, and it did work well, but upon clicking an tag, it redirected you to the actual site
I'm trying to achieve what this website has done, so I can get past website blocking.

HTML image doesn't loud from GOOGLE CLOUD

I have minimal knowledge of coding but I just spent the past 6 hours trying to resolve this issue.
Go here to see the image I am trying to have load.
If I am suppose to chance the SRC lines, how and where do I do that?
The HTML image loads perfectly from my computer.
Like what #mlegg said, I get the same error when trying to go to your link. It looks like that is no longer a valid URL or there is some form of security on it so it's only accessible from your computer (since you said it works from your computer?).
It could also be getting pulled from your browser cache if it was a good URL at one time. Try doing a Shift + Refresh of the page or purposely clear your cache.
If you have the image locally you could try uploading to a different web based repository and src it from there.
Just to cover all bases, I trust you know how to put an image on a web page using the img tag:
<img src="http://lorempixel.com/400/200/">
You might also want to try a different image that you know is available and accessible. You can use the URL above for lorempixel.com or you can scrounge up a different image from a Google Images search.

Notification to the Browser so that it displays new image

I want to achieve:
I have a html page that displays an image.
which is pretty easy. [say my image file name is xyz.jpeg]
When the file changes or replaced with new content, say, the server or by some other mechanism the file is getting changed,
Now I want this modified image gets displayed in the browser WITHOUT REFRESHING the web page
So, kind of a notification system in which the browser is notified with new image, and gets displayed.
I am not expecting the exactly source code, but a direction of which tool that can be used?.
I have come across websocket, but I am not sure if this solves this purpose.
The image can be refreshed on timely manner(for eg 10 seconds) using javascript, ie request will be send to server in specified time interval, and the image will be updated, this is pretty easy to code also. Please refer this question
However this solution has got a negative impact on performance, since the number of request to be served is too high if the page is accessed by multiple users.
Hope this solves your doubt.

render a full web page in node.js code

I am running a node.js server, and it is rendering a web page wonderfully. When I look at this in a browser, it runs exactly as I expect.
However, what I actually want to do is make the call to fully generate the html page - exactly as it is in the browser - within the node.js code, as a call. Currently, I have tried this:
http.request("http://localhost:8000/").end();
(with a few variants). This does exactly what it says, which is to make the single call to the server for the page - what it doesn't do is actually render the page, pulling in all of the other script files, and running the code on the page.
I have tried exploring express and ejs, and I think I need to use one of these, but I cannot find out how to do this fairly straightforward task. All it needs is to render an html page, but it seems to be a whole lot more complex than it should be.
What output do you want? A string of HTML? Maybe you want PhantomJS the headless browser. You could use it to render the page, then get the rendered DOM as a string of HTML.
Use the Mikeal's Request module to make http requests once you captured the response you then can inspect the html however you like.
To make that easier though you should use cheerio, this will give you a jQuery style api to manipulate the html.
Perhaps you are looking for wkhtmltopdf?
In a nutshell, it will render an entire web page (including images and JavaScript) to a PDF document.

Appending random query string value to image URL is not refreshing it

We have a web-based CCTV system - each camera effectively acts like a web server, and you simply browse to a URL to see the camera's image.
I've written a simple HTML page that "aggregates" each camera's image onto a single page. I use javascript to append a random query string value onto each image URL every couple of seconds, forcing the images to refresh. A URL might look something like this:
http://192.168.50.100/camera1/current.jpg?rand=324923
When this HTML page is viewed from the internal network, it all works fine.
Now, I've also created an "external" version of the page on our DMZ, so managers can view the CCTV while off-site. The HTML is identical to the "internal" page except for the image URLs, which are something like this:-
http://foo.com:1234/camera1/current.jpg?rand=...
Each camera has a different port number, so I'm assuming the IT guys are using some kind of port-forwarding. When you view this page, the camera images do appear initially, but don't refresh. In some cases it shows images that were captured seconds or even minutes ago. Using Chrome's F12 feature, I can see the random number changing in the image URLs, so I know the javascript is working.
Any idea why this external page isn't refreshing? It seems that something is serving up cached images, and ignoring the changing query string (the whole point of which should be to request an uncached version).