Greasy Fork is available in English.

Discussions » Development

Going crazy trying to add attribute target to link on webpage.

§
Posted: 12.01.2017

Going crazy trying to add attribute target to link on webpage.

Hey there, thanks for taking the time to read.

I'm going crazy trying to add attribute "target" to link ("a.gr-button") on the web page. I'm working on the site https://www.goodreads.com/giveaway I want to make the web page that opens when I click "Enter Giveaway" to open in a new window/tab.

I've searched through http://www.w3schools.com/ multiple times and can't get any of the examples to work. I must be missing something here. Any suggestions would be greatly appreciated.

woxxomMod
§
Posted: 12.01.2017

The page is dynamically constructed by its javascript code as you can see in devtools (F12) - network panel - click on the first "document" request and see Preview tab. This means that the final document is constructed after userscripts were executed (that is after DOMContentLoaded).

The simplest solution is to use waitForKeyElements which is based on setTimeout.

Post reply

Sign in to post a reply.