How do I insert a JavaScript script into a Widget?
-
I would like to create a “text” widget and plugin a simple JavaScript snippet from airfarewatchdog.com with their script. I have seen this performed as a widget on other sites…
Example: http://beachsideexpress.com/
I past the generated code as asked (copied all code appropriately) and pasted into the content box for my “text” widget and the script will not render in the page.
Any help would be greatly appreciated.
The blog I need help with is: (visible only to logged in users)
-
Script and iframes are not allowed for security & reliability reasons
-
Example of Script Working with <SCRIPT>console.log(‘x’);</SCRIPT> inside a widget.
If a script could not be run from a widget I couldn’t use console.log(), which I clearly have been able to do.
-
Hi,
Regarding javascript, the Code support page says:Users are not allowed to post JavaScript on WordPress.com blogs. JavaScript can be used for malicious purposes. As an example, JavaScript has taken sites such as MySpace.com and LiveJournal offline in the past. The security of all WordPress.com blogs is a top priority for us, and until we can guarantee scripting languages will not be harmful, they will not be permitted.
JavaScript from trusted partners, such as YouTube and Google Video, is converted into a WordPress shortcode when a post is saved.
The last sentence mentions some exceptions. There may be others.
If a [java] script could not be run from a widget I couldn’t use console.log(), which I clearly have been able to do.
What is the website that you have been using script for console.log on? Is it a WordPress.com site? Aself-hosted WordPress.org site? That’s an important distinction. The example of a site using a JavaScript snippet from airfarewatchdog.com, http://beachsideexpress.com/, is not a WordPress.com site.
See the support page WordPress.com and WordPress.org for a comparative introduction to the two “flavors” of WordPress.
This forum is solely for issues regarding WordPress.com accounts and websites. If the site you are seeking support for is a self-hosted WordPress.org site, then please resubmit the request to the WordPress.org support forums. If you haven’t already done so, you may register here: https://wordpress.org/support/register.php, to use the WordPress.org support forums.
-
Yes I realize the importance of distinction now. It is not a WordPress hosted site. Thank you for leading me in the correct direction!
-
- The topic ‘How do I insert a JavaScript script into a Widget?’ is closed to new replies.