user3956506
user3956506

Reputation: 1

How to specify an url with a javascript function in it?

The issue is simple - i have a set hidden blocks with information that are only available when user clicks on certain link on the page. This link's href is calling a javascript (javascript:selBlock('P2', 'P1', 'P3', 'P4');) which shows and hids several blocks with corresponding IDs.

I need to specify a link that will open up the page and run the specified javascript function with predefined parametres. I need to do that exactly inside the url and without any changes to the code that this page is using (which i have no access to).

Here is an example:

The page has a block which shows 1-room flats (their images, costsm params and etc.) or 2-room flats or 3-room flats depending on which link was used. There is a campaign (AdWords) that has 3 campaigns one per each flat type. All of them are leading to the same page.

I need to specify an url for each of the campaign links that will lead to the page and run javascript that corresponds to 1 or 2 or 3 room flats info block, so that user will get exactly what he is looking for without the need to do additional clicks.

As i said - i have no access to the page's code and page's owner refuses to do any changes to it's code, yet he demands from me the exact functionality i've written above.

Any advices on how to do that? Or info on why this should not/cannot be done?

Upvotes: 0

Views: 100

Answers (1)

Quentin
Quentin

Reputation: 943142

There is no way to construct a URL that will load a page and then execute JavaScript on it. If there was, browsers would be effectively building an XSS vulnerability into every website.

Upvotes: 4

Related Questions