How to open the newly created image in a new tab

0 votes

Below code creates the image in the bottom of the same page. How to display that image into a new tab/window instead of displaying in the same page?

success: function (data) {
            var image = new Image();
            image.src = "data:image/jpg;base64," + data.d;
            document.body.appendChild(image);
        }
Jun 19, 2020 in Java-Script by kartik
• 37,510 points
8,933 views

1 answer to this question.

0 votes

Hello @kartik,

You can try something like:

success: function (data) {
        var image = new Image();
        image.src = "data:image/jpg;base64," + data.d;

        var w = window.open("");
        w.document.write(image.outerHTML);
    }

Hope this is helpful!!

answered Jun 19, 2020 by Niroj
• 82,880 points

Related Questions In Java-Script

+1 vote
1 answer

How to delete a localStorage item when the browser window/tab is closed?

Hii @kartik, You can make use of the beforeunload event ...READ MORE

answered Jun 11, 2020 in Java-Script by Niroj
• 82,880 points
23,907 views
0 votes
1 answer

How to trigger an ajax request when the user has finished typing in a text box?

Hello @kartik, Use the code below: //setup before functions var ...READ MORE

answered Sep 18, 2020 in Java-Script by Niroj
• 82,880 points
7,861 views
0 votes
1 answer

Open a URL in a new tab (and not a new window)

Nothing an author can do can choose ...READ MORE

answered Feb 23, 2022 in Java-Script by Aditya
• 7,680 points
2,675 views
+1 vote
1 answer

How can we send message multiple time to a specific person or group in whatsapp using loop?

Hii @kartik,  This is simple task to send single ...READ MORE

answered Feb 28, 2020 in Java-Script by Niroj
• 82,880 points
17,458 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
21,881 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,684 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,548 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
41,740 views
0 votes
1 answer

How to open a URL in a new Tab using JavaScript or jQuery?

Hello @kartik, Use window.open(): var win = window.open('http://edureka.co/', '_blank'); if (win) ...READ MORE

answered Aug 25, 2020 in Java-Script by Niroj
• 82,880 points
5,472 views
0 votes
1 answer

How to use Redirect in the new react-router-dom of Reactjs?

Hello, To navigate to another component you can ...READ MORE

answered May 18, 2020 in Java-Script by Niroj
• 82,880 points
8,428 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP