Images in chrome extensions

Images in chrome extensions

mirajsameermirajsameer Posts: 2Questions: 0Answers: 0
edited October 2013 in General
Hi ,

I am using the dataTable plugin in a chrome extension to beautify some of the table. I am using the zero configuration in initializing the datatable. The only problem I am facing is to load the images. None of the images are displaying in the formatted table, also I am getting the error in the console saying : https://mydomain.salesforce.com/images/sort_asc.png 404 (Not Found).

I have saved the images in the extension folder (/images/image.png) and also I have added all the images in the web_accessible_resources in manifest.json file. Not sure how to get around this issue.

please advise!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Without a test case, I'm afraid I can't say, as I don't have enough information to know what is causing the problem. It sounds simply like the files are present and you need to update your SaleForce content to add the image.

    Allan
  • mirajsameermirajsameer Posts: 2Questions: 0Answers: 0
    edited October 2013
    Thanks for the response Allan.

    As you already know the datatable css files refer to the images using path ('/images/imageName.png'). Now when I inject datatable's js and css files, these path will actually become https://mydomain.salesforce.com/image/imageName.png, but since in there is no image in the salesforce server an error is shown in the console. But in actuality these images are present in the local extension folder. So in the css files (jquery.dataTables.css) instead of ('../image/imageName.png') I had to specify ('chrome-extension://myExtentionId/images/back_enabled.png') which solves the problem. But it is also mentioned in the the license that we shouldn't change any part of the source code. So I was a little worried.

    Anyways,is there any option in the .dataTable() function which will not load any images in the formatted table at all?
  • LonadarLonadar Posts: 1Questions: 0Answers: 0
    I'm having the exact same problem. Did you happen to fix it, mirajsameer?

    I'm looking for either
    a) being able to load the images through a specific URL or
    b) disabling image loading altogether
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    @Lonadar - The message above says it was resolved using the `chrome-extension` protocol.

    @mirajsameer - Your message was October last year - sorry I didn't get a chance to reply at the time! - but just to clarify:

    > But it is also mentioned in the the license that we shouldn't change any part of the source code. So I was a little worried.

    That is not the case. You are free to modify DataTables however you wish! Just keep my copyright header :-).

    > Anyways,is there any option in the .dataTable() function which will not load any images in the formatted table at all?

    Sure - just remove them from the CSS. The JS itself makes no reference at all to images, its all in the CSS.

    Allan
This discussion has been closed.