/    Sign up×
Community /Pin to ProfileBookmark

Dynamic modify other site links

Helloo…. Pls a little help from those who know ?…

i have the next problem:

i have a site1 S1 that has link1 and link2

link1 go to site2 S2 where are localeted also link1 and link2

in S2 link1 is the same as the link1 from S1 (shows the same page) but link2 in S2 shows a different page.

so my question is how can i replace the href of link2 from S2 when i am comming from S1, to redirect me where link2 from S1 redirescts … and when is comming in S2 from other parts to redirect where he usualy redirects?

i tried with a child=window.open()
and then
var s=child.document.getElementsByTagName(“a”);

but it seems that child.document.getElementsByTagName(“a”); the acces is denied.

any ideas how i can do that?

10x in advenced

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@mikemJan 22.2009 — Hi, Not sure I got you but this might help, but only when run via HTTP -through a web server...

s1.html: [code=html]<a href="s2.html">Go To Site 2</a>
<a href="http://www.google.com">Go To Google</a>[/code]


s2.html:[CODE]function init()
{
var ref = document.referrer;
var web = ref.split("/");

if( (web[web.length-1]) === "s1.html" )
{
document.getElementById("link2").href="http://www.google.com";
document.getElementById("link2").innerHTML="Go To Google";
}
}

onload=init;[/CODE]
[code=html]<a id="link1" href="s2.html">Go To Site 2</a>
<a id="link2" href="http://www.yahoo.com">Go To Yahoo</a>[/code]
Mike ?
Copy linkTweet thisAlerts:
@tebbaertyauthorJan 23.2009 — yes , but the only problem is that i can't modify the S2.htm. i need to modify it from S1.htm.

cause if i could modify and add in S2.htm some javascripsts , it was easy ,,,, i would enter a url parameter that specified that ?.... other ideas? ?

i think is imposible to do that ?((
Copy linkTweet thisAlerts:
@tebbaertyauthorJan 23.2009 — i have an ideea ... but i don't know if it is going to work... there are iframes tehnology

can i specify to an iframe to load only one part of the entire page? to give him some x y values or something?
×

Success!

Help @tebbaerty 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...