running javascript from obj-C

Discussion in 'Mac Programming' started by BollywooD, Mar 2, 2010.

  1. BollywooD macrumors 6502

    BollywooD

    Joined:
    Apr 27, 2005
    Location:
    Surfers Paradise
    #1
    (I posted this to the cocoadev mailing list, but thought id post it here also)

    Hi,:confused:

    I am currently trying to implement element blocking into my opensource Safari adblocker project:
    http://code.google.com/p/safariadblocker/


    And I was thinking of taking the approach, of feeding a javascript function to Safari:

    Code:
    function hide_elements(id)
    {
document.getElementById(id).style.display="none";

    }
    where id would be fed to the script from the adblock list(An NSArray of NSStrings). I don't know javascript, so need to figure out how to do this also)

    What I was wanting to know, is how do I apply the javascript to Safari?
    any help would be appreciated.

    thanks in advance
     

Share This Page