1

So my university have this activity calender in their students portal but it is quite messy, I find this in the page

<script>
    $(function () {

        /* initialize the calendar
         -----------------------------------------------------------------*/
        var JsonData = [{"Semester":"Fall 2020","title":"CS602: Assignment# 1","start":"2020,11,27","end":"2020,12,05","backgroundColor":"linea     ...

        
        $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            buttonText: {
                today: 'today',
                month: 'month',
                week: 'week',
                day: 'day'
            },
              
            events: JsonData,
            editable: false,
            droppable: false 
        });


    });
</script>

Is there a way to get that JSON in my chrome extension so I can do something with it there? Thanks in advance!

Arslan
  • 11
  • 1
  • 1
    you can't get the variable, but you can parse string to variable. – uingtea Feb 01 '21 at 11:55
  • You can't access to page variables from chrome extension but you can inject js code to page using extension. In code you should copy variable and store it in html element. Then read content of new element by extension – Mohammad Feb 01 '21 at 11:58
  • Does this answer your question? [Chrome Extension: Get Page Variables in Content Script](https://stackoverflow.com/questions/3955803/chrome-extension-get-page-variables-in-content-script) – Mohammad Feb 01 '21 at 12:07
  • @Mohammad it doesn't because this variable isn't global. – wOxxOm Feb 01 '21 at 12:10
  • @Arslan, since this variable isn't global (it's inside the function) there's no way to extract it as a variable, but you can parse it from the script element's `textContent` in your *content script*. – wOxxOm Feb 01 '21 at 12:12
  • @wOxxOm got it, taking it as text and parsing it, that makes sense, Thanks a lot.. – Arslan Feb 01 '21 at 12:28

0 Answers0