Skip to content
Advertisement

Unexpected behaviour on bookmarklet submit or related database action

[updated below] I have a bit of a problem deploying a site on apache with mod_wsgi with some javascript bookmarklet functionality. The problem is that the bookmarklet (which is a browser menu button) submits to a page like http://stemhub.org/submit/http://the-users-link.com/here which then returns a form to save metadata about the link. The view function (a flask/werkzeug app) checks the database to

Remove empty tags using RegEx

I want to delete empty tags such as <label></label>, <font> </font> so that: will be cleaned as: I have this RegEx in javascript, but it deletes the the empty tags but it also delete this: “<i>italic</i></p>” What I am missing? Answer You have “not spaces” as your character class, which means “<i>italic</i></p>” will match. The first half of your regex

Disable same origin policy in Chrome

Is there any way to disable the Same-origin policy on Google’s Chrome browser? Answer Close chrome (or chromium) and restart with the –disable-web-security argument. I just tested this and verified that I can access the contents of an iframe with src=”http://google.com” embedded in a page served from “localhost” (tested under chromium 5 / ubuntu). For me the exact command was:

Get the Size of a CSS Background Image Using JavaScript?

Is it possible to use JavaScript to get the actual size (width and height in pixels) of a CSS referenced background image? Answer Yes, and I’d do it like this… Some notes… We need to remove the url() part that JavaScript returns to get the proper image source. We need to split on , in case the element has multiple

Calling a method from an event handler

I have this code I am working on but every time I call init method I keep getting an error: this.addElement is not a function Is it because I can’t call methods from event handlers? Answer You should read this book, JavaScript: the Good Parts and visit the Crockenator’s web site here, crockford.com You can also read about the JavaScript

I am trying to make a simple toggle button in javascript

I am trying to make a simple toggle button in javascript. However, the button will only turn “OFF” and will not turn back “ON” I am running:HP Netbook : Ubuntu Linux 10.04 : Firefox for Ubuntu 1.0. Answer Both of your if statements are getting executed one after each other, as you change the value and then immediately read it

Populating JavaScript Array from JSP List

Ok so perhaps someone can help me with a problem I’m trying to solve. Essentially I have a JSP page which gets a list of Country objects (from the method referenceData() from a Spring Portlet SimpleFormController, not entirely relevant but just mentioning in case it is). Each Country object has a Set of province objects and each province and country

Advertisement