Populate DIV dynamically from external Javascript using data from database - javascript

I am developing a plugin for displaying a list of images in others' website. I intend to provide them only one url (probably a JS link) which they need to embed in their site so that they will see those images. These list of images would come from my database. Can you please tell me if such a functionality is achievable using Javascript?
Thanks,
Sachin

Javascript is client only and for those security reasons you cannot and should not connect to a database from js. What you can do is use a webpage to produce those images and use your script to inject the page into their sites. You can do this via an iframe or an object tag.

Related

Wordpress Custom JS Location

We decided to go to another provider and rebuild the website. Accidently, we moved the old domain as well and we can't access the wordpress backend nor the frontend anymor. Now for the new page, I need a Custom javascript code I entered on a specific page with Elementor. Where can I find my old code now without accessing the homepage? I have FTP and Database access.
Where do you put the code? Depending on the answer you need to look at different locations.
Afaik elementor doesn't support custom js nativly. You can bypass that with a html widget or custom plugin. If you used elementors gui for that it's probably stored like all other elementor related content inside wp_post_meta of your database.
If you don't know the page where it was used I would suggest to export the database as sql and use an editor to search for a text string related to the code (for example the url of the ajax request).
If you know the page you can do the same but faster. Look for the id of the post with the code, search for it in wp_post_meta and go on like mentioned before.
If you havn't used elementors gui the script could lie inside a directory on the server probably inside your theme.

How can I send email with PDF file on my Wix website

I want to send the email with PDF file. But the PDF file should automatically generate with the user input value.
I have tried to solve that problem. But I couldn't find customize email field section. For the more, there isn't a feature to send the email with PDF file.
I have tried to inject my own JavaScript and PHP code. But I can't handle my website code. I could see just HTML Dom. And I could add my own HTML and CSS code. In another way, I try to built my own Wix plugin. But I couldn't find a way to built my own plugin.
How can I solve this problem? I want to know is it possible or impossible.
Corvid (https://www.wix.com/corvid/) allows you to add javascript to your Wix Site and add custom functionalities. If you want to generate dynamic PDF files based on your site user's input I suggest you use a PDF Generator API, an example of how to implement this can be found here: https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-pdf-generator

What is the best way to display webpage content for a given URL using javascript?

I am developing a small labeling tool that given a URL should display a document hosted on that URL and allow a user to choose a label for that document.
I want to display the contents of the URL for this purpose. As far as I know, I can either get the URL content, parse the contents, and display or use an iframe option.
Without using parser
Iframes are not enabled for the target URL, the contents of which I want to display. Is there any other way to do this using javascript without using parser?
Using parser
I can crawl the contents of the URL, get everything between and dump it in the webpage area.
I'm new to javascript and front end development so I am not sure whether these are the only options.
Are there other options to do this?
If the parser is the only option, Can I dump the HTML that I get from the remote URL? I understand that images and other media that may be within on remote url won't be displayed. Is there any other caveat to this method? More importantly, Is this the best way to do this?
Most sites do it via the iframe like you mentioned like codepen.
Also, you can use Puppeteer ( a headless browser ) to do these sort of things. Get the contents using web scraping or take a screenshot or print a pdf. Pretty nifty library.
Most things that you can do manually in the browser can be done using
Puppeteer! Here are a few examples to get you started:
Generate screenshots and PDFs of pages. Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. "SSR"
(Server-Side Rendering)).
Automate form submission, UI testing, keyboard input, etc. Create an up-to-date, automated testing environment.
Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.
Hope this helps !

Show external website in my aspx page and include own javascript

What I am trying to accomplish:
A visitor of my website should be able to load an external website into my website and click elements on this external websites to retrieve the XPath of the element. Like Firebug but completly online.
I have already managed to create a piece of javascript to click elements on MY website and return the XPath of the element.
Now I need to know how to show an external website in my ASP.NET WebForms page and inject my own javascript.
I tried to use a literal control and download the external website's HTML code with a WebClient.
WebClient webClient = new WebClient();
string result = webClient.DownloadString(txtURL.Text);
litWebsite.Text = result;
Problem here is: The the external website's design will be broken if I don't consider the CSS references.
Maybe this is a complete wrong approach.
Any ideas?
Thank you!
I'm not sure it's possible.
Sure, you could display the web page via iframe but unless you owned the content, I'm not sure you can control it with your own javascript.
Maybe I'm wrong but I've always heard that your could do very little with other web content in your own project.

How to extract content from a given url's document using gwt?

I'm new to GWT and am trying to build a web scraping app.
I have a custom URL, say www.amazon.com.
I want to be able to open this url, scrape information from its source (preferably by storing the html content as a Document in gwt) and print the scraped info on the console.
I've tried creating an iframe in the current page and setting its src to the custom url. But that didn't work out.
Do tell me if you need me to elaborate / clarify any aspect of the question
Thanks!
Scrap the URL on the server and write the output through a servlet. Open this Servlet URL in a Dialog box in GWT.
Or if the content (of the scrapped page) can be stored in other formats like a HashMap, then you can RPC the server to get the data object and display it in an HTML panel at the client side.
Thanks,
Sreehari.

Categories

Resources