Discussion Forums  >  WebViews and HTML for Mobile

Replies: 10    Views: 196

AppOne
buzztouch Evangelist
Profile
Posts: 348
Reg: Apr 03, 2012
London
13,980
10/27/13 04:00 AM (10 years ago)

Custom HTML screen and javascript

Google states the following should be pasted into any HTML page: <script type="text/javascript" src="//www.google.com/trends/embed.js?hl=en-US&cmpt=q&content=1&cid=TOP_QUERIES_0_0&export=5&w=300&h=420"></script> However, when I paste it into the Custom HTML plugin screen and run in Xcode it doesn't show?? I've embedded videos etc with no problem so assuming the javascript is the problem. Any beginner-friendly pointers anyone? Thanks!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/27/13 04:16 AM (10 years ago)
I'm curious 'why' Google says you need to paste that into an HTML Page... the 'src' statement looks a little off... shouldn't it lead off with 'http://'...? Cheers! -- Smug
 
AppOne
buzztouch Evangelist
Profile
Posts: 348
Reg: Apr 03, 2012
London
13,980
like
10/27/13 04:24 AM (10 years ago)
its an embed like youtube video embeds - with those when i paste them into custom html screen they just work
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
10/27/13 12:15 PM (10 years ago)
If you embed this code into a simple html page, you can test it outside buzztouch. I tried, saw nothing. I suggest going back to the page where you copied it from and chack the instructions.
 
KozmoWeb
Aspiring developer
Profile
Posts: 342
Reg: Dec 08, 2012
Sarasota, FL
8,520
like
10/27/13 02:25 PM (10 years ago)
Hi @AppOneI think @SmugWimp is on the right track here... I've had problems like this in the past. Add the http: after the src=" and I bet it will work. So: <script type="text/javascript" src="http://www.google.com/trends/embed.js?hl=en-US&cmpt=q&content=1&cid=TOP_QUERIES_0_0&export=5&w=300&h=420"></script> YouTube has started to provide embeds without this to accommodate http: and https: for their embeds. Good luck! William
 
AppOne
buzztouch Evangelist
Profile
Posts: 348
Reg: Apr 03, 2012
London
13,980
like
10/27/13 02:57 PM (10 years ago)
Hi William - Adding the http: after the src= brings up a URL error. AlanMac - yeah I went back and checked, the instructions are: "Paste this into any HTML page:"
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
10/27/13 02:59 PM (10 years ago)
I think it is even simpler - the javascript code from google does not work!
 
AppOne
buzztouch Evangelist
Profile
Posts: 348
Reg: Apr 03, 2012
London
13,980
like
10/27/13 03:04 PM (10 years ago)
Me too. Never thought I'd say it, but Google could be wrong! Unless it has something to do with adding separate .js file somewhere in project
 
AppOne
buzztouch Evangelist
Profile
Posts: 348
Reg: Apr 03, 2012
London
13,980
like
10/27/13 03:05 PM (10 years ago)
But if Google's wrong about this, what else could it be wrong about!!
 
AppOne
buzztouch Evangelist
Profile
Posts: 348
Reg: Apr 03, 2012
London
13,980
like
10/27/13 03:05 PM (10 years ago)
No, I won't believe it! Google is always right!!!
 
cpmilez
Aspiring developer
Profile
Posts: 63
Reg: Jan 03, 2012
Ipswich, UK
6,030
like
11/17/13 06:39 AM (10 years ago)
Just stumbled across this post, I guess you have sorted but thought i'd give some input.. google has advised on using that code for a reason. Using "//" is valid and tells the web browser if the site is running under http to load the js file under http and if https to load the js file under https. This stops any issues with security errors showing in the browser. For example if you were to load the web page via https:// and the js code was set to use http the browser would give you a scary message that the page was trying to load insecure content which though it may be true it doesn't really effect the security for the user and would scare the avg user. Now I guess the reason why you can't enter // in the customHTML screen is because the WYSIWYG editors validator doesn't like the syntax and is expecting either http or https. If your page will always load under http then there is no issue and you can just http anyway if not just use https and it will work for both scenarios.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.