Google App Script Warning - javascript

I have created an app script using user account 1 and used the script on a Google site. When I view the site using user account 2 , I receive a warning message which can be dismissed.
I have made a copy of the same script on the same site, however there is no option to dismiss this script. I would like to know what would cause this problem as the new script is an exact copy of the old script.
Copy Script http://i.stack.imgur.com/R151l.jpg
Original Script http://i.stack.imgur.com/FIyhm.jpg

If you mean the warning DOES NOT APPEAR then it doesn't show up if you're logged in as the owner of this script (app).
If you made the copy from account2 and are viewing it from the same then you won't see it.

I have installed Chrome on iPhone 4 and script 1 does not work when I use the following lines to call my html page, however the same script works with Chrome installed on Android and PC.
Script1:
output.setSandboxMode(HtmlService.SandboxMode.NATIVE);
However, when I use the following code, it works.
Script 2:
output.setSandboxMode(HtmlService.SandboxMode.IFRAME);
Now, the problem with script 1 is that I get a warning which is dismissable (This application is created by another user.), with script 2 I cannot dismiss the warning. That is why I want to use script 1 universally.
Will someone help me know how can I make script 1 work on Chrome for iOS?

Related

Javascript error on mobile view

I got a strange problem on my site taikuri Kim Wist on mobile view. I don't know if the problem is on Apple devices, but with Samsung and Android devices it is definitely there.
When typing the root domain address, the page wont load and keeps jumping back and fort. Furthermore it jumps directly to another page on my site which is an inner page.
There is on line 109 of the index page a javascript file js/script.js
If I remove this script, the problem goes away, but the script is needed to operate the middle (stellar) section of the page. I have not modified the script.js file in any way and there was no problem one week ago. I made a new footer to my page, but it should not generate an error like this.
If anyone knows why this occurs I would be very grateful.
I was able eventually to find the error, which was inside script.js file.
I commented out //window.location.href = $(this).attr("href"); on line 85.
This solved the problem and the page is now displaying correctly on Android devices.

Chrome Extension - Pass URL argument (google-chrome http://www.google.com)

I've developed a chrome extension/kiosk app that opens up Google Chrome in a "kiosk mode" with 4 navigation buttons, HOME, RELOAD, BACK and FORWARD. So it's basically an application that opens up Chrome in a window without Omnibox but added 4 buttons.
This is because the user should not be able to change URL or anything else. Just navigate via the web interface and the 4 simple buttons.
Now, this application/extension is packed with a hardcoded URL. Which means you can't change the URL.
in my browser.html I have the following code:
<webview src="http://www.example.com/" style="width:100%; height:100%"></webview>
and in my browser.js I have the following code:
document.querySelector('#home').onclick = function() {
navigateTo('http://www.example.com/');
};
As you can see the URL is hardcoded both in HTML file and the javascript file.
My question is. Can I change the URL so it's not hardcoded in the extension/kiosk app?
So if I type google-chrome --app-id="jlfmnfhdcdmkibjnbeajhedeoahajnfc" http://www.google.com
into a terminal or cmd, I would want google.com to be displayed.
There may be a simple solution or no solution at all. This is my first attempt at making a chrome extension/kiosk app. So I'm an amateur in this area.
If you want to take a look at the source code, then you can find it on github.

Firefox extension: invoking function from webpage js

I'm trying to automate some boring, duplicated data entry into a web application at work.
I'm sorry if the answer is well known but I've spent hours in google trying to figure it out.
The problem is, in the web-based application none of the links are simple HTML, 'a href' type links, they use javascript.
I can see in one of the .js files for the website that the function invoked when a link is clicked is defined as follows
function sendEvent(eventtype, targetid, value)
...and with the Firefox debugger I can see that in order to do the simple page navigation I want to do, my extension has to invoke the websites js function as follows (the 'value' parm can be null)
sendEvent("click", "mx709")
I found this similar question. The suggested method is
content.wrappedJSObject.funcFromPage()
or
getBrowser().contentWindow.wrappedJSObject.funcFromPage();
... but running either of those lines in my extension doesn't seem to invoke the function and hence "click" the link I want clicked
EDIT 1 - in case it wasn't clear, the code I actually put into my extension was:
content.wrappedJSObject.sendEvent("click", "mx709[R:3]");
EDIT 2 - Also tried this, no dice. I have the Firefox debugger open, and a breakpoint on the top of the 'sendEvent()' function. Every time I click a link in this web app, I hit the breakpoint, when I try lines like the above (or the following), the breakpoint is not tripped
window.content.document.defaultView.wrappedJSObject.sendEvent("click", "mx709[R:3]");
The wrappedJSObject method should work.
Open up scratchpad and copy paste this:
var indexOfTabWithMyDocument = 1; //1 means 2nd tab, 0 is first tab
Services.wm.getMostRecentWindow('navigator:browser').gBrowser.tabContainer.childNodes[indexOfTabWithMyDocument].contentWindow.wrappedJSObejct.FUNCTIONTORUN()
Set the environment of scratchpad to browser. And run. It will work.

Google +1 button causes JavaScript error

We've recently started using the Google +1 button on our page, but whenever we include the Google script block this JavaScript error comes up in IE8:
"No relay set (used as
window.postMessage targetOrigin),
cannot send cross-domain message"
This is a weird one, can't find out much about it. Does anyone have any clue what it means? I've tried moving the script include to the top of the page, but it doesn't help.
Google +1 currently does not work on any version of IE.

JavaScript file not updating no matter what I do

I have an external JavaScript file and whether in FireFox or Chrome, whether all browsing data is cleared, it will NOT update no matter what. I believe something happened when I made a backup of my file, which I simply added "_thedate" to the end of the name. Then Save As back to the original name.
Now I cannot seem to get rid of the old JS no matter what unless I change the name of the file, which I really don't want to do, or add the script to the PHP page, which crowds it.
Anyone know the solution to this?
You are sure you are linking to the same file and then editing that same file?
On some browser, you can use CTRL F5 to force a refresh (on the PC). On the Mac, it is Cmd Shift R
Firebug also has a net tab with "Disable Browser Cache".
But I want to give a warning here: even if you can hard refresh, how do you know your customers are getting the latest version? So you need to check, rather than just making sure you and your program manager can do a hard refresh and just go home and take the paycheck next month. If you want to do a job that change the world for the better, or leave the world a little bit better than you found it, you need to investigate more to make sure it works for your customers too (or else, sometimes the customer may call tech support, and tech support may read the script of "clear out the cookies and it will work", which is what happens to me sometimes). Some methods down at the bottom of this post can ensure the customers get the latest version.
Update 2020:
If you are using Chrome and the DevTools is open, you can click and hold the Refresh icon in front of the address bar, and a box will pop up, and you can choose to "Hard Reload" or even "Empty Cache and Hard Reload":
Update 2017:
If you use the Google Chrome debugger, it is the same, you can go to the Network section and make sure the "Disable cache (while DevTools is open)" is checked, in the Settings of the debugger panel.
Also, when you link the JavaScript file, use
<script src="my-js-file.js?v=1"></script>
or v=2, and so forth, when you definitely want to refresh the file. Or you can go to the console and do a Date.now() and get a timestamp, such as 1491313943549, and use
<script src="my-js-file.js?t=1491313943549"></script>
Some building tools will do that automatically for you, or can be configured to do that, making it something like:
<script src="main.742a4952.js"></script>
which essentially will bust the cache.
Note that when you use the v=2 or t=1491313943549, or main.742a4952.js, you also have the advantage that for your users, they definitely will get the newer version as well.
How about adding a '?2' to the tag?
<script src="a.js?2"></script>
The server should return the same file with or without the '?2', but the browser should see it as a different file and redownload. You can just change this query string whenever the file is changed.
adapted from: http://blog.httpwatch.com/2007/12/10/two-simple-rules-for-http-caching/
I've had this problem before, it's very frustrating but I found a work around. Type in the full address of the js file (i.e. yourhost.com/javascript.js) and load it. You will probably see the old version load. Then hit f5 to refresh that page and you should see the new version load. The js file will now be updated in your cache and the code should run as you expect.
The solution I use is.
Using firefox
1. using web developer --> Web Console
2. open the java-script file in new tab.
3. Refresh the new tab you should see your new code.
4. Refresh the original page
5. You should see your changes.
I had this problem and solved in Chrome by just disabling Cache:
- Click F12;
- Go at Network tab;
- Click on "Disable Cache".
A little late to the party, but if you put this in your html, it will keep your website from updating the cache. It takes the website a little longer to load, but for debugging purposes i like it. Taken from this answer: How to programmatically empty browser cache?
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
Rename your js file to something else temporarily. This is the only thing that worked for me.
The best way around browsercaches is to append a random number to the path of the js file.
Example in pseudo code:
// generate a random number
int i = Random.Next();
echo "<script src='a.js?'" + i + "></script>";
This will make sure your browser always reloads the file, because it thinks it's a different file because of the random number in the url.
The server will always return the file and ignore what comes after the '?'.
In both Firefox and Chrome, that is really annoying, but because of their default settings which can be changed the following way and then they work. I tried in Chrome and Firefox both with same order of steps.
Press F12 (Open Inspector)
Click Network, and then click Disable Cache
Now click Clear icon. In Firefox, it shows as a trash bin icon on left corner, in Chrome it is the second left icon, in between 'stop recording' and 'Filter'.
Now press F5 or refresh the page
They do update the resources with their fresh copy as they re-download them.
In Asp.netcore we can use asp-append-version taghelper
<script src="~/js/site.js" asp-append-version="true"></script>
Are you 100% sure your browser is even loading the script? Go to your page in Firefox and use the console in Firebug to check if the script has been loaded or not.
I have the same problem for awhile, and manage to figure out... And my case was because I have 2 javascript with the same function name.
1.Clear browser cache in browser developer tools
2.Under Network tab – select Disable cache option
3.Restarted browser
4.Force reload Js file command+shift+R in mac
 
Make sure the fresh war is deployed properly on the Server side
I was going insane trying to get my js files to refresh and I tried everything. Then I did a header check and remembered I was using Cloudflare!
In Cloudflare you can use dev mode to disable proxy.
Don't forget to check any errors in webpack compilation. Sometimes the application.js in app/javascript/packs/ doesn't reload due to webpack compilation error.
When I run into this issue I try this sequence of steps:
Hard refresh the page.
Clear cache + cookies.
Add a static version to my script.
src="my-script-name.js?v=1"
If the above does not help, add a dynamic version to my script:
src="my-script-name.js?v=" + Date.now() + Math.random()

Categories

Resources