I'm trying to get urls off a page that has this sort of code repeated-
<a onmouseout="swho.alone.OnMouseOut(event)" onmouseover="swho.alone.showPopup(event, 'DR647E481', 'pra**', '', '', 'everyone', 'closed')" href="/SWApp/detailAction.do?key=DR647E481&search=pra**&soundex=&stanfordonly=&affilfilter=everyone&filters=closed">Ajay Prakash</a>
using this code in Jquery - $jq("#PublicResults a[href]")
For some reason when I call $jq("#PublicResults a[href]").text() I get Ajay Prakash.
I'm not sure why and I'd like to know why.
But more than that, I'd like to know how to get only the URL.
Thanks for the help!
EDIT-
OK, the response below is giving me an undefined in the firebug console and I'm not sure why- to overcome that I tried -
$jq("#PublicResults a[href]").attr("href")
which gives me only the url for the page that I'm on, as opposed to all of the links - any idea why?
Try (not tested) -
$jq("#PublicResults a").attr("href")
Related
I'm using ng-href which seems to produce the correct results, and the correct behaviour on Chrome but not on Firefox.
on the page www.mydomian.com/clubs/ in my rails app i have the Haml
%a{'ng-href' => '\players\{{player.id}}'} {{player.name}}
when run this produces this html
<a ng-href="\players\14208" class="ng-binding" href="\players\14208">Dylan Robertson</a>
when I use Chrome and click on this link I'm taken to
www.mydomian.com/players/14208
however on firefox when I click on this same link I'm taken to
www.mydomian.com/clubs/%5Cplayers%5C14208
I can't work out why anyone any ideas?
I have
$rootElement.off('click') set in my app.run
Try changing your slashes to go the other way;
<a ng-href="/players/14208" class="ng-binding" href="/players/14208">Dylan Robertson</a>
I'm trying to add global hotkey support to Spotify (and others). For this I have to execute a content script in the player app iframe, but no matter what pattern I try Firefox just won't execute my content script.
This is what I try to do:
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: /^https?:\/\/play\.spotify\.com\/apps\/player\/.+/,
attachTo: ["frame"],
contentScriptFile: [data.url("content.js")]
});
Has anyone any idea what could be wrong? How can I make it match?
See:
https://bitbucket.org/panzi/play-control/src/f1dbd217661c0f09d3615dce7b8b1cab9f8fbf70/browser-plugin/firefox/playcontrol-spotify/lib/main.js?at=default
The same thing for Chrome works perfectly well:
https://bitbucket.org/panzi/play-control/src/f1dbd217661c0f09d3615dce7b8b1cab9f8fbf70/browser-plugin/chrome/playcontrol-spotify/?at=default
I'm a regex noob, but in the doc examples, they don't use ^ even when the string starts with 'http'.
Try getting progressively more stringent to see which part of the regex it doesn't like. Throw an onAttach: console.log("pageMod attached"), in there to make sure it isn't being attached and something else isn't causing the problem.
/.*play\.spotify\.com\/apps\/player.*/ If this works, then either it doesn't like the beginning or the end. Try:
/https?:\/\/play\.spotify\.com\/apps\/player.*/
/^https?:\/\/play\.spotify\.com\/apps\/player.*/
.*play\.spotify\.com\/apps\/player\/.*/
.*play\.spotify\.com\/apps\/player\/.+/
If all of the above work, then your string should work too.
URL matching works the way I've written it. The bug was something else.
Okay, if I could offer a bounty for this I would - I offer virtual karma.
As mentioned in the title I have an .NET/MVC4/Jquery Mobile/Knockout website. On the index page there is a button
<button data-bind="click: getResults" data-theme="f">Search</button>
which calls a javascript function
$.mobile.navigate("/results?option1=a&option2=b", { transition: amw.transitions.slide });
This works great on all browsers and devices except Chrome/iPhone. As far as I can tell the version of Chrome or iOS does not matter. The resulting URL in the address bar is
iPhone/Chrome: http://www.mywebsite.com/#/results?option1=a&option2=b
Other Devices: http://www.mywebsite.com/results?option1=a&option2=b
I have put alerts throughout jQuery mobile to try and figure out what is going on (if someone knows a way to debug chrome on iOS let me know) and I cannot see where the extra # is being added.
This may not seem like a big deal but the url ends up being passed on to a downstream service that really does not like the extra #.
I can put in a hack at the call to the service to strip out the # but I would really like to figure out what is happening.
The only suspect line I can find in jQuery mobile (1.3.0) is line #2298
// if the hash is included in the data make sure the shape
// is consistent for comparison
if( data.hash && data.hash.indexOf( "#" ) === -1) {
data.hash = "#" + data.hash;
}
But I am not sure what this does or why it would occour only on Chrome/iPhone.
so StackOverflow people - what is going on?
Thanks.
We have been using Jquery from this link http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js for drag and drop. Suddenly we notice it is not working now and there is no code change done our side. We notice the error is pointing to these line and error is TypeError: a.curCSS is not a function? What will be solution to this problem?
e&&e.call(i)},g)}):this._focus.apply(this,arguments)},scrollParent:function(){var g;g=a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter
This javascript error is caused by jQuery and jQueryUI being out of sync with each other. Rather than go back to an older version of jQuery, I would update jQuery UI. This link from the jQueryUI blog talks about support for the latest version jQuery. I experienced the same error before updating jQuery UI.
Base on another answer... I did something slightly different...
Instead of replacing:
$.curCSS(element, attrib, val);
with:
$(element).css(attrib, val);
I created a new function:
$.curCSS = function (element, attrib, val) {
$(element).css(attrib, val);
};
$.curCSS: This method is simply an alias for jQuery.css() from jQuery 1.3 onward. Although it has never been part of the documented API, some external code has been known to use it, perhaps thinking it was “more efficient.” Now it’s “more gone.” - from the page here.
This error can occur by using curCSS also.
replace:
$.curCSS(element, attrib, val);
with
$(element).css(attrib, val);
I had same problemm. Search for a link like this in your project:
https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
and change it with this:
https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
It worked for me.
I am encountering a very stragne bug, i am trying to call javascript from AIR like this
this.webView.loadURL( 'javascript:alert(5)' ); -- This works
this.webView.loadURL( 'javascript:alert("hello there")' ); -- This is not working
I am not able to pass strings, in any function. I am not sure why this is happening and it is driving me insane. It works correctly in Android though.
Any help would be greatly appreciated.
Thanks
EDIT: after spending sometime tweaking it seems to be the space. alert("hello") works fine alert("hello there") doesnot.
Ok I think I found it.
You cannot pass whitespaces. You can in Android and Desktop - but no, the glorious iOs refuses to digest such an advanced entity.
So you must encode your whitespaces in strings and make sure that there will be no stray whitespace in your functiond declration
for example
this.webView.loadURL("javascript:test('hey__there')"); //will work
while
this.webView.loadURL("javascript: test('hey__there')"); //this won't
this.webView.loadURL("javascript:test( 'hey__there' )"); //this won't
Good luck