This is the HTML for the main logo in the corner of the IMDb website.
<a onclick="(new Image()).src='/rg/home/navbar/images/b.gif?link=%2F%3Fref_%3Dnv_home';" href="/?ref_=nv_home" id="home_img" class="navbarSprite home" title="Home"></a>
I don't understand the onclick event. What is that doing? It doesn't make sense to me to see image instantiation as an onclick event for an image.
It's a tracking click. Although it is creating an image, the sole purpose is to make an easy external request to the tracking URL to log the click (the image is never displayed on the page). b.gif is not really a GIF file, but a server-side tracking script.
Related
I am attempting to call an element in a third-party website to refresh the webpage, but the "Refresh" button seems to be contained in a separate applet. I have been researching various methods of accomplishing this (and I am decently familiar with HTML, CSS, Javascript etc.), however I have been unsuccessful in identifying the element in the webpage, and subsequently how to actually call the button.
Here is an image of the "Refresh" button - when I hover the mouse, there is no indication of a link or function to call, and when I use the browser inspector it seems that I can only investigate the border of the page which has the actual HTML:
I have tried to use the Firebug plugin for Firefox to view all the script for the page, but it only seems to show me the 'body' or in this case the frame of the website (not the applet itself). Is there any easier way to find the element, or a program that I can use to simulate the clicking of this "Refresh" button?
We have a small group of guys who play the game below. We take these games and stream them on Twitch so we can watch them as a group live. We have gotten down the process of automatically opening the URL and streaming the games. However, to get the plays to show there is an OnClick function that we have to manually remote in each time and click. Is there a way we can open this webpage and simulate the click so they are turned on? If you click the link below, you'll see a yellow button called Plays. If you click it you'll see what we want to be able to turn on without manually having to do it.
http://glb2.warriorgeneral.com/game/replay/171542
This depends a lot on how you're automating the page opening.
Normally, you can simply call .click() on an element in JS. But since you want to click something on a page you don't control, it gets complicated.
If you're simply opening a new tab/window via Javascript, you won't be normally able to do this because of cross-domain JS protections. You can disable them which is not recommended--if you go this path, you'll want to load the page in an iframe and execute a callback on it: see this answer. The callback you'll want will look something like:
function(){ window.frames[0].document.getElementById('toggle_plays').click(); }
Knowing how you're doing the automation would help significantly on how to solve the problem within your limits.
So I want to have a link to a site x (which I am not the developer of) that automatically performs some javascript function after it is clicked. EG.
javascript:window.location="http://www.google.com"; alert("Hello");
This performs the alert function before loading the page which is not desired.
Does anyone else know how this can be achieved?
Thanks.
If you load it in an iframe, I guess you could somehow wait for a certain element to be present and then execute your code.
You cannot do that.
Doing this, poses a security threat (XSS), and therefore disallowed by almost all the browsers!!
Worst scenarios to think of, if you had this control:
The Script to capture the username/pass of the user and mail it to you by further calling an Url.
Could play a role in unwarranted tracking/spamming.
EDIT:
This can be done only if user interaction in involved.
For eg:
You can ask user to drag a link to his bookmark toolbar, and the link should contain:
Test Click
And then to whatever page the user goes, whenever he clicks the bookmark button (link), an alert happens (or whatever script you may put.)
If the link is changing the "current" windows location, you cant execute your scripts after the external page has started loading.
You can't.
A walk around way is to put the site in to an iframe in your page. Then alert your message in its onload event. And of course your url on address bar will not change.
Our sales people accepted flash banners without a click tag and then scream in anger when our ads server (openx) didn't count correctly the clicks.
So, I'm looking if exists some way of "simulate" a click tag, I don't know exactly how, maybe with some JavaScript.
You could put a blank <span> or <div> element in front of the embedded flash, and then use a JavaScript event listener to open the desired URL.
Just pass the link as a variable to your Flash movie in the embed code.
I have a pretty simple problem which I have not been able to fix myself (I am having trouble manipulating iframes).
Basically, go to say this page....
http://andrew.koallo.ca/new/393NelsonSt-JordanFisher
click on "Click here to Map"...and a map should load up for you....now if you his back once...it will only take back the iframe....so basically you have to hit the back button twice to return to your original page.
Is it possible to avoid this?...Upon clicking the "Click here to Map" button I set the src of the iframe equal to the respective source....
I was reading that perhaps location.replace can help? have no been able to get it working.
Thanks for any help,
Andrew
the page you mentioned is offline atm, but you need to set the url for the iframe like this:
$('#myIframe').get(0).contentWindow.location.replace('http://...');
so the url won't make it into the browsers history.
Either put a "back" button in the page with an onclick event to the referrer or change the iframe's code to only use Ajax calls.