• 0

HTML/JS not making output


Question

Posted (edited) · Report post

HTML/Java script type code not working(not giving output) in either of Textbox or media box. They just stay blank!

In case u want, the code is,

<script>
  (function() {
    var cx = '010246379168072596147:zwu_remky9w';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:searchbox></gcse:searchbox>

Which is a Google CSE code. Any fix?

 

My site is TechGainer.com , and here's what I did >> https://drive.google.com/file/d/0B0vZboRb5S2OZS0yNmV5Q3hNZEE/edit?usp=sharing

Edited by rijans

Share this post


Link to post
Share on other sites

9 answers to this question

  • 0

Posted · Report post

Javascript is not HTML.

Anyway I created a custom search to test this, I added a textbox and put this code in it:

 

<script>
(function() {
var cx = '002850982299749365326:eonehb8boro';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>

 

And that works no problem. So either the code you are entering is wrong/broken or google is blocking your site.

Maybe you should ask them?

Add your code to a blank html file on your server and open that in a browser, see if that works, or try my code.

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

the google drive link returns 

 

403. That’s an error.

Your client does not have permission to get URL/DqwDdniyoXVu50sUGM4VtYNxn1wx55BIqpy0dB1gjJR6xD6DoxvXXF6wWHr4pfRR87i9iVjbCZQsnNYfrom this server. (Client IP address: XXXXXXXXXX)

ACL Denied That’s all we know.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

HI,

 

The TextBox section is supposed to house nothing more than text, the MediaBox is supposed to house text, html and other media via html. None of them can house JavaScript. If you wish to implement javascript, I recommend you use a hook. For more information on hooks see our documentation here - https://github.com/pagelines/Docs/blob/master/advanced/hooks.md

Share this post


Link to post
Share on other sites
  • 0

Posted (edited) · Report post

HI,

 

The TextBox section is supposed to house nothing more than text, the MediaBox is supposed to house text, html and other media via html. None of them can house JavaScript. If you wish to implement javascript, I recommend you use a hook. For more information on hooks see our documentation here - https://github.com/pagelines/Docs/blob/master/advanced/hooks.md

 

Danny

Then take a look at http://docs.pagelines.com/tutorials/using-sections ... Checkout the TextBox info >>>......" Textboxes can usually accommodate HTML, PHP or shortcodes in addition to text".......<<<<
Then what's that?

Edited by rijans

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I've also updated the documentation on that page, as that was incorrect.

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Javascript is not HTML.

Anyway I created a custom search to test this, I added a textbox and put this code in it:

 

<script>
(function() {
var cx = '002850982299749365326:eonehb8boro';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:search></gcse:search>

 

And that works no problem. So either the code you are entering is wrong/broken or google is blocking your site.

Maybe you should ask them?

Add your code to a blank html file on your server and open that in a browser, see if that works, or try my code.

 

Interestingly this code is working on my site in text box!!!! but none of mine!!!!!!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi, everybody! And sorry if I'm interrupting your discusssion : )
 
@rijans - That code works because it is "stand-alone" CSE <gcse:search> component.
 
You are using <gcse:searchbox> and you need <gcse:searchresults> in order CSE to work:
 
If any of you would have similar problem, you can see complete answer (to this question) on CSE Google product forum:
 
Cheers!
3 people like this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

@galeksic 

It's great to see you here! 

Thanks for your assistance and time!

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now