This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Attach File Through mailto URI
I have an HTML link like
Send Mail
I would like attach a file in the Mail Client when a User click the this link.
Is it possible in JavaScript or using jQuery, html5?
You can try MS ActiveX:
var OA = new ActiveXObject('Outlook.Application');
var OAItem = OA.CreateItem(0);
var OAItemAtms = OAItem.Attachments;
OAItemAtms.add('http://foo.com/some_image.png');
You can read more on this here - compose-and-send-e-mail-from-javascript-by-using-outlook
No.
And of course JQuery won't help since that is also Javascript.
You really need something serverside to manage this for you.
Related
This question already has answers here:
How to interpolate variables in strings in JavaScript, without concatenation?
(17 answers)
Closed 5 years ago.
As I'm sure you're about to see for yourself, I'm relatively new at coding. I've been struggling to get the png image from json file to show up on my codepen. I've already tried several suggestions I found in my Stackoverflow searches but nothing I've tried seems to work for my situation.
Here's the link to my codepen:
http://codepen.io/mbabaian/pen/MpjbZv
The code I'm trying to use to get the image at this time is:
var currentIcon = wd.current.condition.icon;
// weather icon settings
$("#current-icon").html("<img src='wd.current.condition.icon' alt='weather icon'/> ");
And here's the particular json data where the image is located:
https://api.apixu.com/v1/current.json?key=68629a769f564f9bb6450153170703&q=auto:ip
Please let me know if you need any additional information from me about this. Thanks in advance.
Simply use
$("#current-icon").html("<img src='"+wd.current.condition.icon+"' alt='weather icon'/> ");
Here is your updated codepen
You create currentIcon, use it
$("#current-icon").html('<img src="'+currentIcon+'" alt="weather icon"/>');
This question already has answers here:
Read/write to file using jQuery
(5 answers)
create a text file using javascript
(5 answers)
Closed 7 years ago.
<script>
function select(image)
{
var str1;
//.....
str1 = newURL;
var fso = ActiveXObject("Scripting.FileSystemObject");
var abcd = fso.CreateTextFile("C:\\Desktop\\testfile.txt", true);
abcd.WriteLine(str1);
abcd.close();
}
</script>
<img id= "img1" src="abc.png" alt="" onclick="select(this)" />
i am writing this script code in my view.cshtml page. I dont know whats wrong with this code. i want this function to be execute when i select an image. is there any Assembly refernce to be added here or something? if there is browser compatibilty issue ? I have also istalled ActiveX plugin for chrome but its still not working ? so can any one suggest a better solution for this please?
?
This question already has answers here:
Get formatted HTML from CKEditor
(12 answers)
Closed 9 years ago.
I'm using CKEditor in my web app, but I don't know how to get html content from it.http://cksource.com/ckeditor
I searched online found one said using getData() method, but there is no getData() method after typing dot after the controler. Can anyone give me a sample code to get html from CKEditor controller? Thank you in advance.
To get htmlData from editor you should use the code snippet bellow:
var htmldata = CKEDITOR.instances.Editor.document.getBody().getHtml();
If this solution won't work, check if you have BBCode plugins installed.
getData() is part of the javascript API.
It seems that you are trying to do it at the server side, so you should check the specific API of whatever wrapper you are using, or just check the value in the form posted data.
Not sure how you're implementing usage of the CKEditor.
If you're replacing a textarea using CKEDITOR.replace( 'NameOfTextarea', this should work:
CKEDITOR.instances.NameOfTextarea.on( 'instanceReady', function( instanceReadyEventObj )
{
var editorInstanceData = CKEDITOR.instances.NameOfTextarea.getData();
alert( editorInstanceData );
});
Replace "NameOfTextarea" with the name of your textarea, it's used to name the editor instance.
It's a good idea to put it inside the "on instanceReady" function so you don't get an undefined error.
Joe
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to rewrite URL without refresh, like GitHub.com
let say I have variable in Javascript
var currentpage = 0;
my address page address is www.xyz.com/page/1
when I click somewhere and js function trigger
currentpage = 1
//Here I want to change/rewrite www.xyz.com/page/2
//Without redirecting to this page
See pushState (browser support currently limited).
You can't. You have to use the '#' or '#!' notation and pass the page number after it, then do trigger some js on load to figure out which page to display.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
how can i validate a url in javascript using regular expression
I want to validate whether user input a valid internet adress like
www.hotmail.com
http://www.abc.com.pk
Here's the js function:
function validateString(regexPattern, testString) {
var regexObj = new RegExp(regexPattern);
return regexObj.test(testString);
}
Finding the regex for URLs is just a matter of typing it in google. Here's a good one I've used before.