Pergunta

I am currently trying to make a chrome extensions that inserts an event in the default calendar of a user. However, I have been running into some problems.

Firstly, when I try and run my script it says that I must include an image in the HTML file from the same domain. However when I do that (I put an image in the same folder as my other .html and .js files), it says that the image must be from an HTTPS source and not HTTP.

Secondly, when I try to insert an event I get an error that says:

Refused to execute inline event handler because it violates the following Content
Security Policy directive: "script-src 'self'
https://www.google.com/calendar/feeds/default/private/full
https://www.google.com/jsapi
https://www.google.com/calendar/feeds/iskl.edu.my_7fqt0f2sj8odprhnalgdsa1a5k@group.calendar.google.com/public/full
https://www.google.com/uds/?file=gdata&v=2.x".

The problem is that I have already included some of the sources that should be allowed and I am not sure what else it is that I am missing?

I have been having problems with this for the last few weeks. Any help would be really appreciated. If there is any other way of inserting an event, please let me know (it must be using JavaScript and on chrome extensions).

Foi útil?

Solução

I figured it out. I just changed the Content Security Policy parameters to

"script-src 'self' https://www.google.com/*

so that all sources from www.google.com and sub-sites area allowed.

Also, instead of having an inline event handler, I changed my button to as follows:

<button type="button" class="button">CREATE NEW EVENT</button><br><br>

Then in my javascript file I added:

$('.button').bind('click', createNewEvent());

All this, instead of:

<button type="button" class="button" onclick="createNewEvent()">CREATE NEW EVENT</button><br><br>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top