Jump to content


Photo
- - - - -

HTML/JS not making output

textmox htm mediabox html javascript

Best Answer Simon_P , 05 March 2014 - 09:11 PM

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.

Go to the full post


  • Please log in to reply
9 replies to this topic

#1 rijans

rijans

    Super Member

  • Members
  • PipPipPipPip
  • 127 posts
  • Framework Version:DMS 1.1.8
  • Country: Country Flag

Posted 04 March 2014 - 09:08 PM

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...dit?usp=sharing


Edited by rijans, 04 March 2014 - 09:10 PM.


#2 greenfly

greenfly

    Advocate

  • Members

  • 3268 posts
  • LocationManchester, England
  • Framework Version:latest
  • Country: Country Flag

Posted 04 March 2014 - 09:29 PM

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.



#3 rijans

rijans

    Super Member

  • Members
  • PipPipPipPip
  • 127 posts
  • Framework Version:DMS 1.1.8
  • Country: Country Flag

Posted 05 March 2014 - 07:53 AM

@Martin Davies

 

Here's the image link http://postimg.org/i...k7rbqklqd/full/


Edited by rijans, 05 March 2014 - 07:56 AM.


#4 Danny

Danny

    Is Awesome!

  • Moderators
  • 15785 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 05 March 2014 - 11:43 AM

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/p...vanced/hooks.md



#5 rijans

rijans

    Super Member

  • Members
  • PipPipPipPip
  • 127 posts
  • Framework Version:DMS 1.1.8
  • Country: Country Flag

Posted 05 March 2014 - 07:51 PM

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/p...vanced/hooks.md

 

@Danny

Then take a look at http://docs.pageline.../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, 05 March 2014 - 07:51 PM.


#6 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 05 March 2014 - 09:11 PM   Best Answer

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.


  • rijans likes this

#7 Danny

Danny

    Is Awesome!

  • Moderators
  • 15785 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 06 March 2014 - 10:56 AM

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


  • rijans likes this

#8 rijans

rijans

    Super Member

  • Members
  • PipPipPipPip
  • 127 posts
  • Framework Version:DMS 1.1.8
  • Country: Country Flag

Posted 06 March 2014 - 03:08 PM

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!!!!!!



#9 galeksic

galeksic

    Newbie

  • Members
  • Pip
  • 1 posts
  • Country: Country Flag

Posted 06 March 2014 - 06:15 PM

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!

  • Simon_P, James B and rijans like this

#10 rijans

rijans

    Super Member

  • Members
  • PipPipPipPip
  • 127 posts
  • Framework Version:DMS 1.1.8
  • Country: Country Flag

Posted 06 March 2014 - 06:53 PM

@galeksic 

It's great to see you here! 

Thanks for your assistance and time!


  • galeksic likes this





Also tagged with one or more of these keywords: textmox htm, mediabox html, javascript