Reposition on a linked page with no anchor?

U

ukrbend

I'm trying to create a link to a certain part of a page on another
website that has
no anchor (i.e. ID or name) at the position on the page I want to link
to. So I can't do something like theotherpage.html#anchorname.
However, since there is a unique keyword at the position I want to link
to I thought perhaps I could load the page, then search for this
keyword and then reposition to that point. Can javascript do something
like this?

Thanks
 
I

Ivo

I'm trying to create a link to a certain part of a page on another
website that has
no anchor (i.e. ID or name) at the position on the page I want to link
to. So I can't do something like theotherpage.html#anchorname.
However, since there is a unique keyword at the position I want to link
to I thought perhaps I could load the page, then search for this
keyword and then reposition to that point. Can javascript do something
like this?

Yes, this is a common task for Javascript, but like anything Javascript, it
will only work within one website. Cross-domain restrictions (google for
that) prohibit script from your site to access scroll positions or anything
on the other site. All I think of for this situation is you write to the
other webmaster and ask for that anchor to be put there.

hth
ivo
http://www.lear.shakespearians.com/
 
L

Lee

ukrbend said:
I'm trying to create a link to a certain part of a page on another
website that has
no anchor (i.e. ID or name) at the position on the page I want to link
to. So I can't do something like theotherpage.html#anchorname.
However, since there is a unique keyword at the position I want to link
to I thought perhaps I could load the page, then search for this
keyword and then reposition to that point. Can javascript do something
like this?

The short answer is "no".
Javascript from one site can't access a document loaded from another site.

The longer answer is that you might be able to cripple the security restrictions
of your own browser to allow you to get away with it, but it's not something
that you'll be able to talk other people into doing.
 
T

Thomas 'PointedEars' Lahn

ukrbend said:
I'm trying to create a link to a certain part of a page on another
website that has no anchor (i.e. ID or name) at the position on the
page I want to link to. So I can't do something like
theotherpage.html#anchorname. However, since there is a unique
keyword at the position I want to link to I thought perhaps I could
load the page, then search for this keyword and then reposition to
that point. Can javascript do something like this?

No. scrollIntoView(), which is also proprietary to the IE DOM,
will not work when the target document is not already displayed.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top