I used webview to show the webpage,
view->setUrl(QUrl("C:\\Qt\\2010.07\\qt\\serbest\\googleSearch.htm"));
in the HTML code I put some ajax code googleSearch. After I execute the program, the webview runs and there are results (pages links).
When I clicked any of the links they do not open. So what do I do to open the links I clicked?
How can I access the title of the links from the result of javascript in Qt?
"C:\Qt\2010.07\qt\serbest\googleSearch.htm"
That's not a URL, it's a Windows pathname. Also, it has troublesome unescaped backslashes: \201 is a string literal escape for the control character U+0081 in many languages (including JavaScript as per your tags, though the snippet does not appear to actually be JavaScript).
The URL form of that filename would look something like:
"file:///C|/Qt/2010.07/qt/serbest/googleSearch.htm"
You can convert a filename into a URL using fromLocalFile().
Related
I have a chrome extension that extracts all short url with the form e.g. ini/ini#8012 from any page using a regex.
var regex = /[\w]+.[\w]+#(?:\d*\.)?\d+/g;
What I want to do is to make that short url into a clickable link in my popup window, and parse it into my web app, so clicking any short url in the list would take you to a web app. The web app url is like this
http://192.101.21.1889:8000/links/?user_repo=ini%2Fini&artID=8012&tc=4&tm=years&rows=5&submit=
The user_repo, and ID characters are from the extracted short url. First of all, is this possible? And if it is can anyone point me in the right direction as to what to do?
You can use Content Scripts and inject JavaScript, then perform whatever you want to do.
Readings:
Content Scripts
I am using C# to crawl a website. All works fine except it can't detect dynamic JS links. As an example, a page with over 100 products may have few pages and the "Next Page"m "Prev Page" link may JS dynamic urls which is generated on click. Typical JS code is below:
<a href="javascript:PageURL('
cf-233--televisions.aspx','?',2);">></a>
Is there anyway of getting the actual link of the above href while collecting urls on the page ?
I am using Html Agility Pack but open to any other technology. I tried google this many times but seems no solution yet.
Thanks.
Have you tried to evaluate javascript to get actual hrefs? It might be helpful Parsing HTML to get script variable value
Or maybe you should check what PageURL function does (Just open the website with a browser and write at it's console PageURL without parentheses. It will show you code of the function) and rewrite it with C#
AbotX allows you to render the javascript on the page. Its a powerful web crawler with advanced features.
I am trying to achieve Sending a URL Link in EmailTo:body but having problems.
Email
But This Displays following body in outlook (the Special character breaks the link):
But if the body could be generated as given below can work in my favour:
I tried many things but couldn't succeed.
Thanks
I was also facing this problem yesterday. Here is my solution and it works perfectly.
What happen here exactly is when we encoding the url encoding is happening fine, but we load on html page or outlook encoded url get decoded because of many factor like iis or some of browser behavior. What I did is I am double encoding. So when page load on outlook it is decode only once, one layer of encoding is still there and we got what we want.
As per you code :
var concatID = '&'+"Resource"'&'+"Blog"'&'+"Test-Blog-2"'&'+"October"'&'+"Lets-Abolish-Paper.Aspx";
var enocdedUrlAttr = encodeURIComponent(concatID);
var doubleEnCode = encodeURIComponent(enocdedUrlAttr);
Now when you see this in browser you will get desire result. Attach your doubleEnCode with your localhost and make url.
Try this. You can still encode a straight quote mark into the email.
Email
Fiddle of Email Link
To add a line break you need to use %0D%0A where you would like a break (or two). As your link contains a quote character - which aren't permitted in URLs - will break the link formatting.
Writing an HTTP server in Ruby, I need to edit a file in the browser which uses certain source code (HTML, JavaScript and Ruby). I need to put any text file content in the value of a textarea:
"<textarea>__CONTENT__</textarea>".gsub('__CONTENT__',File.read(filename))
However, this doesn't work if the files contain some special sub-trings, such as </textarea>. So I tried to 'prepare' the data, by doing certain replacements in the file content. However, there is an issue if the file contains source code with HTML/Ruby content, and especially if I try to send the source of my HTTP server. This chain of replacements seem good:
File.read(__FILE__).gsub(/&/,"&").gsub('<',"&"+"lt;").gsub('>',"&"+"gt;")
However, this is not good enough. There is an issue (in the web browser) when the file contains \'! Is there a useful technique to place any text in the textarea (server side and/or browser side)?
CGI::escapeHTML will "prepare" strings to be HTML-safe.
# require 'cgi'
CGI::escapeHTML(File.read(__FILE__))
this form is good:
CGI::escapeHTML(File.read(FILE))
except for the backslash character : double backslash become simple.
I found that :
Server side, replace backslash with &99992;
CGI::escapeHTML(File.read(#uri).gsub('\\','&9999'+'2222;'))
Browser side, replace in textarea "&99992222;" by backslash character :
var node=document.getElementById('textarea_1');
node.value=node.value.replace(/\&9{4,4}2{4,4};/g,String.fromCharCode(92));
Hopping that there is no sources with &99992222; !
I'm using the Contact Form 7 plugin for Wordpress.
It allows you to put in a single line of javascript in the additional settings to trigger some javascript code when the send button is pressed.
My original code looked like this, which works fine:
on_sent_ok: "_gaq.push(['_trackPageview', '/CallbackFormFilled']);"
The "On_sent_ok:" is a specific parameter for the contact form.
I have a requirement where i need to concatenate the pathname of the URL together with the virtual URL i have created in the code above.
I tested concatenation of strings using 'Alert' to make sure i was doing it correctly, but when using the following code my pageview tracking fails
What is the correct syntax for concatenating the strings correctly here?
on_sent_ok: "_gaq.push(['_trackPageview',window.location.pathname+'CallbackFormFilled']);"
Try:
"_gaq.push(['_trackPageview',"/"+window.location.pathname+'CallbackFormFilled']);"