/    Sign up×
Community /Pin to ProfileBookmark

Obtain the source of an image from a parent window.

Hello to everybody,

My problem is this: I am writing a seperated script which is launched with the Contextual Menu that appears with a right click over an image in a web page. So we have two separate pages, the first one is the web page (which can change, so this would be useful for every web pages) and second one is an script (in a separated .htm file) which is launched with the Contextual Menu of a right click mouse event.

Any help will be appreciated. Thank you.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@scragarApr 21.2005 — a question:

1. What exactly is your question/flaw/thing you can't do.

it sound like you have everything planned out, all you'll have to do is just put it into javascript(or is that your problem?).

either way I'll kinda prefare a little more info or I could just wind up wasteing my time writing something that it later turns out is not what you want.
Copy linkTweet thisAlerts:
@kudApr 21.2005 — More info:

I am trying to create sort of Plugin for MSIE 6.0. What I need to get is the url of the image that has been right-clicked (for instance in Google main page). I mean, I (with my browser and my plugin) browse to a web page, select an image, right-click it and select a context menu option.

As I have added a new entry within the windows registry then a Javascript code gets executed. There I must get the url of the image that has been clicked. I have managed getting all the images in the document (see code below)

<SCRIPT LANGUAGE="JavaScript" defer>

var parentwin = external.menuArguments;

var doc = parentwin.document;

var str = "";

for (int i = 0; i < doc.images.length; i++)

{

str = str + doc.images[i].src;

}

alert(str);

</SCRIPT>



How can I know which is the one I clicked?. Is this possible?.



Thanks in advance.
Copy linkTweet thisAlerts:
@scragarApr 21.2005 — this thread has been double posted, solution may be found [url=https://webdeveloper.com/forum/showthread.php?p=355347#post355363]here[/url]
Copy linkTweet thisAlerts:
@forofoauthorApr 21.2005 — How you can read in the title the idea is obtaining the source property of the image in which you have done the right click in the parent window.
×

Success!

Help @forofo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...