Add a google gadget to webpage - javascript

I'd like to add a google calendar gadget to a webpage.
This page shows the gadget
http://www.google.com/ig/directory?synd=open&url=http://www.google.com/ig/modules/calendar3.xml
The linked page includes code to paste into a webpage
http://www.gmodules.com/ig/creator?synd=open&url=http%3A%2F%2Fwww.google.com%2Fig%2Fmodules%2Fcalendar3.xml&lang=en
I tried creating a simple page:
<!DOCTYPE html>
<html>
<head>
<title>Calendar</title>
</head>
<body>
*<script src="//www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/calendar3.xml&up_calendarFeeds=&up_calendarColors=&up_showDatepicker=1&up_showEmptyDays=0&up_showExpiredEvents=1&synd=open&w=320&h=447&title=Google_Calendar&lang=en&country=ALL&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>*
</body>
</html>
but the resulting page does not display a calendar, just '**'. I'm storing this page in a local file (not on a server) and opening in a browser.
Any suggestions, including another way to get the same functionality?

The information on this page leads to a solution:
https://support.google.com/calendar/answer/41207?hl=en

Related

how to jump to another page in Google Apps Script site

I would like to give a page transition.
In web server (Google side), I prepare an html file like this,
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<h1>Moving</h1>
</head>
<body>
link
<script> window.location.href='https://google.com'</script>
</body>
</html>
Note that using the link link, I can jump to the google page (google.com).
However I got a console message like below and cannot jump automatically with Javascript...
Refused to display 'https://google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
I think this is a limitation in Google Apps Script..
Is there anyway to let users jump without clicking the link?
You were able to do it with window.top.location.href.
However, it seems it has been just blocked by Chrome CORS since this month.

How to build a new html page/tab and/or change to make a report

I have a page with a button to create a simple report. On click of the button, it calls the back-end program to get the relevant data in a JSON format.
Upon receiving the data I want to load the following page in a new window/tab,
Load a fragment of the HTML maintained in a separate html,
Place it in , and
Plug the values received from back-end.
If I use window.open("Mypage.html"), it loads the page and shows it in new tab, but then I cannot use $("#report").load("fragment.html") and also I cannot replace values of that fragment.html.
How to solve this problem?
------------------------------
Mypage.html
------------------------------
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="report"></div>
</body>
</html>
--------------------------
fragment.html
--------------------------
<h1>Sample Report</h1>
<h1>name</h1>
<p>Address</p>
You could store the html fragment and json data in the browser's local storage. The first and second page both have access to the same local storage as long as the pages are served from the same origin (server ip and port). Checkout Shared variable scope between two browser tabs? [duplicate].

Chrome developer environment for Javascript

I am at the start of learning Javascript, but within the first 10min I hit on a Chrome issue. I'm attempting to display the code I wrote with Visual Studio in the Chrome console, but rather than showing the code in the section below the menus 'Element', 'Console', 'Source' etc, the code displays exactly as I wrote it, but in the view panel including all html tags below the menu section 'Apps', 'Bookmarks', 'Customize Links' etc. How do I resolve this, any answers?
I tried to use ctrl-o to open the .js file whilst in Visual Studio and also whilst on Chrome, but only the file path to the .js file opened, and when subsequently clicking on the file it looked like the image below.
chrome not displaying JavaScript code in the location I want it to be
To clarify - you are loading a .js file in the browser which is what is displaying in chrome (the content of that file).
What you want to do is run that js file and have Chrome's JavaScript interpreter (V8) parse that information. To do that, you must add your script to an index.html page and then in index.html, load that e.g something like <script type="text/javascript" src="script.js"></script>
Alternatively, you can just run the JavaScript directly in index.html via
<script type="text/javascript">
// your JavaScript
</script>
You are opening the javascript file directly in the browser, not opening an .html file with a javascript tag. That's why Chrome is showing you the file content.
If you want to execute your javascript code in the Chrome console, paste it directly in the "console" tab of the developer tools.
If you want to execute your javascript code in a web page, you have to create an html file with a script tag loading your javascript code, something like:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="main.js"></script>
</head>
<body>
</body>
</html>
In order to see your html content on browser you should load .html file instead of loading .js file
you can include your javascript code in two ways
Add your Javascript code inside the script tagcreate a new javascript file with extension .js and add it in your html file
Example1 (Adding Javascript inside script tag)
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
console.log("good morning");
alert("good morning");
</script>
</body>
</html>
Example2 (Adding Javascript from external file)
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="nameOfFile.js"></script>
</body>
</html>

not able to run linkedin company profile script

I copied the code from this link(https://developer.linkedin.com/plugins/jymbii) by giving company name and clicking the Get Code button. It generated the code given below
<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/JYMBII" data-companyid="5818" data-format="inline"></script>
I pasted this code in tag of a html file and then run the html file in Chrome, Firefox and IE, but all browser gave a blank page as output.
How should I use this in my jsp/html file, so that it could generate the job-posting feed.
Please help me.
Just add those two script tags in the <body> tag. If you have added them in the <head> tag it will not work

How to load js file on load of HTML?

<HTML>
<Head>
<Title>My Test</Title>
<script src="http://someurl.com/test.js"></script>
</Head>
<Body>
This is for test
</Body>
</HTML>
Above mentioned is my HTML code. When I right click my page & hit "view source" I can see exact same code.
But what my requirement is, instead of <script>...</script> I want actual javascript code from test.js should be displayed when I am hitting "view source".
I tried to put it in iframe, but it didn't worked.
What you want is impossible to achieve with HTML and an external JS file.
There is no way to make View Source show anything other than the actual source code of the URL.
If you want to look at the JavaScript source code, then look at the URL for the JavaScript. Most browsers will hyperlink it in View Source to make it easy to do.
If you really want the JS to be displayed as part of the source of the HTML document, then you have to make it part of the HTML document. Remove the src attribute and copy the contents of the JS file to between the start and end tag of the script element.
add a <script> tag in the <head> section
<script src="path/to/test.js"></script>

Categories

Resources