最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Inject Javascript to a website - Stack Overflow

programmeradmin2浏览0评论

I have a problem in which a website presents me with a list of several thousand pages of 50 items available per page. Unfortunately they did not offer a way to "jump" pages.

For example, if I am on page 1 and I want to go to page 2500 out of 5000 my only option is to click the highest page number displayed on the screen (in increments of 5). This will advance me 5 pages at a time until I get to page 2500. As you can imagine this takes an enormous amount of time.

I noticed at the bottom when I hover over the page number I see "javascript:handleSubmit(6);" where 6 represent the page number I am hovering over.

If I could somehow just replace this 6 with 2500 I think I would be in business. I did some searching on injecting javascript into a webpage and from what I read I should be able to simply type my statement in the address bar without any http:// or other info... just javascript:handleSubmit(2500);

Unfortunately this isn't working. Is there something else I need to know? How can I acplish my objective?

I have a problem in which a website presents me with a list of several thousand pages of 50 items available per page. Unfortunately they did not offer a way to "jump" pages.

For example, if I am on page 1 and I want to go to page 2500 out of 5000 my only option is to click the highest page number displayed on the screen (in increments of 5). This will advance me 5 pages at a time until I get to page 2500. As you can imagine this takes an enormous amount of time.

I noticed at the bottom when I hover over the page number I see "javascript:handleSubmit(6);" where 6 represent the page number I am hovering over.

If I could somehow just replace this 6 with 2500 I think I would be in business. I did some searching on injecting javascript into a webpage and from what I read I should be able to simply type my statement in the address bar without any http:// or other info... just javascript:handleSubmit(2500);

Unfortunately this isn't working. Is there something else I need to know? How can I acplish my objective?

Share Improve this question asked Oct 1, 2009 at 21:48 radesixradesix 6,3025 gold badges26 silver badges40 bronze badges 0
Add a ment  | 

5 Answers 5

Reset to default 3

You can do this with firebug... Put a breakpoint on the code. Step into the call, but then modify the value of the parameter in the watch dialog before it is used. Alternatively, add "handleSubmit(2500)" as a value to watch in the watch menu (that will evaluate the expression, with side effects).

Use javascript:void(handleSubmit(page number here));.

The easiest way to inject javascript is to use the firefox firebug console.

Although on the address bar

javascript:handleSubmit(2500) 

should work if handleSubmit is a global function

Other way, Firefox and Greasemonkey (alert with input number of page u are would like to be and after it javascript:handleSubmit(x) ... should work, but i don't have any experience with monkey :)

While puttig JS into firebug as many suggest will work fine, you don't actually need firebug.

Putting

javascript:handleSubmit(2500)

into the URL bar of your browser and clicking Go / pressing Enter should work.

Incidentally, most bookmarklets work on the same principle.

发布评论

评论列表(0)

  1. 暂无评论