Welcome guest, is this your first visit? Create Account now to join.
Results 1 to 8 of 8

This is a discussion on How to invoke function in chrome extensions within the Plugins Development section, part of the Chrome Plugins category: I have modified the contents of the webpage. For eample, i have replaced all the occurance of particular text in ...


  1. #1
    rohit is offline Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Default How to invoke function in chrome extensions

    I have modified the contents of the webpage. For eample, i have replaced all the occurance of particular text in the webpage to a hyperlink and this hyperlink has onClick javascript event
    (for eg: xyz to <a href="#" onClick="ShowAlert()">xyz</a> ).
    But when i click on the link ShowAlert function is not invoked. I have defined ShowAlert function in one of the content script files.

    What could be the reason ? and what is the solution for this problem ?

    Thank in advance
    Rohit

  2. #2
    mg2's Avatar
    mg2
    mg2 is offline Senior Member
    Join Date
    Jun 2009
    Location
    Karlsruhe, Germany, Europe
    Posts
    328

    Default

    Have you tried something simple to see if your problem is in the function or the replace mechanism for example just <a href="#" onClick="window.open('google.com')">xyz</a> just to see if it's working?
    BETTER GMAIL for Google Chrome

    Win7 RC1
    Google Chrome Dev latest version

  3. #3
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    Its a security issue, look here......
    http://code.google.com/chrome/extens...-communication

  4. #4
    rohit is offline Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Default

    @PAEz

    Thanks for your response. "Window.open" works. The problem is, when i invoke external javascript functions.

    Any suggestions appreciated.

    Thanks and Regards
    Karthik.S

  5. #5
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    The answer is at the link I just gave you.

  6. #6
    rohit is offline Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Default

    @PAEz,
    sorry man, actually i posted reply to mg2. Thanks for your patience.

  7. #7
    rohit is offline Junior Member
    Join Date
    Dec 2009
    Posts
    5

    Default

    @mg2

    Thanks for your response. "Window.open" works. The problem is, when i invoke external javascript functions.

    Any suggestions appreciated.

    Thanks and Regards
    Karthik.S

  8. #8
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    To repeat myself, the answer to invoking external javascript functions is a security issue and the link I gave you has your answer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •